Pergunta

I am attempting to deploy the first MVC application to an existing production server. The application works in Visual Studio debug mode, but on the server, if I try to call up my home path I get an HTTP 403 error unless I enable directory browsing in IIS, in which case I see the contents of the directory, as you might expect.

The server is running Windows Server 2008 and is on the same domain as my development computer.

What I have tried so far:

  • Verified that .NET framework 4.5 has been installed on the server by checking the registry as described here.
  • Created a new node in the IIS Manager tree using "Add Application".
  • Upgraded the application node with aspnet_regiis.exe as described in this helpful post.
  • Set the application to allow Anonymous authentication to make sure the problem wasn't being caused by authentication errors.
  • Confirmed the presence of my Views folder and contents on the server as described here.
  • Attempted to deploy by copying my entire visual studio project to the application folder on the server.
  • Attempted to deploy by right-clicking and selecting Publish from the project node in the Visual Studio 2013 solution explorer. Selected "Delete all existing files prior to publish." I did this both with and without "Precompile during publishing".

Any ideas what to check next?

Foi útil?

Solução

I finally fixed the problem by changing my Web.config file, adding the two lines below that reference the UrlRoutingModule. Do not add the preCondition="managedHandler" attribute!

<configuration>
  <system.webServer>
    <modules>

      <remove name="UrlRoutingModule-4.0"/>
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" />

    </modules>
  </system.webServer>
</configuration>

This helpful post by Thomas Marquardt discusses MVC routing in great detail.

Also, if you're troubleshooting your own MVC routing, be sure to check the answers posted by Ferruccio and stead.

Outras dicas

You will also need to install the MVC framework on the server.

http://www.asp.net/mvc/mvc4

I've had a similar problem. It turned out that the deployment process put it into the DefaultAppPool, which uses .NET 2.0. Once I moved it to the "ASP.NET v4.0" app pool, it started working.

In IIS Manager, right click on the app and select "Manage Application". Then select "Advanced Settings..." and change the app pool.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top