As you have reached here and reading through this post, it makes me assume that you are facing the same issue which I did and are looking for solution after trying multiple workarounds for the error i.e. Error 403: Forbidden whenever any MVC application is deployed on Azure Virtual Machine.
Based on the error title, it appears that this must have to do something with permissions to some resource in IIS but that is not the thing here and I came to know this only after spending significant amount of efforts behind this. Lesson learnt– Error message could be misleading.
Initial investigation lead me to multiple solutions and looking at the answer’s help count on different sites it appeared that mentioned solutions were working for other people, but why not for me?
As mentioned, there are multiple links you will get describing resolutions which worked for number of people below are few such links
Based on the error title, it appears that this must have to do something with permissions to some resource in IIS but that is not the thing here and I came to know this only after spending significant amount of efforts behind this. Lesson learnt– Error message could be misleading.
Initial investigation lead me to multiple solutions and looking at the answer’s help count on different sites it appeared that mentioned solutions were working for other people, but why not for me?
As mentioned, there are multiple links you will get describing resolutions which worked for number of people below are few such links
- 403 Forbidden when running an ASP.NET MVC 4 application on Azure
- 403 forbidden after publishing asp.net MVC
What worked for me?
After trying all the possible solutions mentioned in the links I was still getting same error. Here is the thing which worked for me
I was simply missing few IIS settings which I did not do while enabling IIS role on my Azure VM (Note that I am using Windows Server 2012 R2)
All I needed to do is,
Open Server Manager on VM hosting my MVC web application
Click on Add roles and feature
Reach to the screen for selecting the role on this server and make sure you have enabled below two features along with other required features to enable IIS role.
Note that, I managed to solve this by enabling below checkboxes (as shown above)
- ASP.NET 4.5
- .NET Extensibility 4.5
And after completing the installation, the 403 Forbidden error was gone.