Microsoft Web Matrix - to Manage Azure Web App
In this blog I would focus on a small mistake that can take a lot of time for us to debug and also will discuss about Microsoft’s WebMatrix tool.
Answer to the second issue is since the folder was empty it did not got created in the live web app.
I will choose 2nd option and run the application to check the functionality. Now it works seamlessly.
In this blog we learned about a new tool WebMatrix and a possible way to debug things.
This blog is also published on Voksedigital website.
Scenario :
Implementing a functionality of uploading a file in our application existing application and writing the data to a table.Steps :
- Open the application in visual studio.
- Create “UserUploads” folder in the project which will contain uploaded files
- Write the required piece of code, to upload a file and append the data to a table, in one of the controller (for MVC application).
- Run the program to check, it works for me since I can see the file data in required table.
- Now build and publish the functionality to live website.
- Check the functionality if it works in live website. For me it is not working.
Possible Issues:
- file is not uploaded or
- file is uploaded but data is not written to the table
Challenge:
I was really confused as in what could be the possible reason behind this failure. The challenge here was, now how should I debug and find the possible error, since same peice of code was working fine in the local environment.How To Debug Your App In Above Scenario?
To manage Azure web apps Microsoft has created an application called “Microsoft WebMatrix”. WebMatrix has a simple interface, once you sign-in into the WebMatrix using your Azure credentials it will give you options, to create new application or to open the existing application from your Azure subscription. In the following steps we will check if file is uploded or not.- Click on Open.
- Click on Windows Azure, It will display all your sites created under your subscription.
- Select your web app and click on Ok.
- In left panel we can see all the folders related to our application.
- Search for “UserUploads” folder, but folder is not there
Diagnosis :
So what I understood from this was, my “UserUploads” folder was not created in the live web app when I published my website.Now The Question Arises Why So?
So now we will look into visual studio if the uploaded file is present or not? To me file is not visible. In solution explorer there is a option called “Show All Files”, I clicked on that and then I was able to see the uploaded file in “UserUploads”. This file is hidden for some reason. When I right clicked on the uploaded file, I got the option “Include in Project” and clicked on it, now the file was visible even when I disabled the “Show All Files” option.Answer to the second issue is since the folder was empty it did not got created in the live web app.
What To Do Now?
Now I have 2 options to resolve my issue:- publish the webapp again
- create a folder “UserUploads” using WebMatrix
I will choose 2nd option and run the application to check the functionality. Now it works seamlessly.
In this blog we learned about a new tool WebMatrix and a possible way to debug things.
This blog is also published on Voksedigital website.
Comments
Post a Comment