【问题标题】:issue deploying asp.net mvc 5 to iis server将 asp.net mvc 5 部署到 iis 服务器的问题
【发布时间】:2014-02-07 09:15:38
【问题描述】:

我正在尝试将我的网站发布/部署到 iis 7 服务器。

当我在 Visual Studio 中单击运行时,它运行良好。

我按照教程使用网络部署到我的服务器。文件在那里,一切似乎都很好。

但是当我访问网站时:http://10.0.0.12:8000/

我得到:HTTP Error 403.14 - ForbiddenThe Web server is configured to not list the contents of this directory.

我已提供站点管理员凭据。我检查了是否配置了默认页面。

我做错了什么?

这是我的配置文件:

<configuration>
<configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
 <appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.1" />
 <httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
<modules>
  <remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
  </dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  <providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  </providers>
 </entityFramework>
</configuration>

【问题讨论】:

  • 你使用什么版本的 IIS?
  • 你在机器上安装了 MVC 吗?您是否在 web.config 中正确设置了所有处理程序?正确的应用程序是否在正确的路径下运行?等等。
  • 机器上安装mvc?请详细说明?根据:stackoverflow.com/questions/19963307/…你不需要安装

标签: asp.net-mvc iis iis-7 web-deployment


【解决方案1】:

要尝试检查的事项:

  1. 在您的 web.config 中的 &lt;modules&gt; 部分设置 runAllManagedModulesForAllRequests="true"attribute:

    <modules runAllManagedModulesForAllRequests="true">
    
  2. 网站配置为使用使用 ASP.NET 4.0 的应用程序池,集成管道模式
  3. ASP.NET 4.0 在 IIS 中注册。使用以下命令确保是这种情况(如果您在 32 位服务器上,可能需要使用 Framework 调整 Framework64 文件夹):

    c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -ir
    

【讨论】:

  • 天哪。我不知道为什么这如此困难。你的 #3 救了我。
  • 非常感谢 Drain your #3 made my day 竖起大拇指
【解决方案2】:

转到周三站点物理部署位置的 web.config 并打开它 而且你会发现一个xml标签,几乎在xml文件的末尾,内容如下

 <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
               ....
    </handlers>
  <!--ENTER THE CODE HERE-->
  </system.webServer>

在给定位置添加以下代码片段保存并刷新您的站点

<modules runAllManagedModulesForAllRequests="true">

同时尝试删除任何其他已经可用的标签!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-04
    • 1970-01-01
    • 2015-02-11
    • 2015-03-12
    • 1970-01-01
    相关资源
    最近更新 更多