1

我有一个 ASP.Net MVC 2 网站,可以通过Visual Studio 2010(RTM 零售)的 ASP.Net 开发服务器中的http://localhost/Admin/ContentMgr/访问该网站。

当我尝试将站点部署到 Windows 2008 R2 、 IIS 7.5 时,url 总是返回 404。

首先,我的应用程序池在 .Net 4.0 和集成模式上运行。其次,我的 IIS 确实有“HTTP ERROR”和“HTTP Redirection”功能

这是我的 web.config。

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
  <system.web>
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
<!--
    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>
-->
    <pages>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" >
      <remove name="UrlRoutingModule"/>
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
      <remove name="MvcHttpHandler" />
      <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler" />
      <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </handlers>
    <httpErrors errorMode="Detailed" />
  </system.webServer>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
4

1 回答 1

0

.net 4 中不包含 ASP.net MVC 2。您有两种选择:

  1. 将文件部署System.Web.Mvc.dll到应用程序的 /bin 文件夹中
  2. 按照这个神秘的过程在服务器中安装 ASP.net MVC 2
于 2010-10-20T02:44:32.277 回答