MVC 5部署IIS7 403访问被拒绝

时间:2018-02-15 16:45:13

标签: asp.net-mvc-5 iis-7

我正在升级MVC和.Net版本。我正在开发一个正在升级的MVC 5网站,它在IIS7和Windows 10上运行良好。

.Net 4.6.1 MVC 5.2.3.0 EntityFramework 5.0.0.0 System.Web 3.0.0.0

IIS在App Pool中设置为v4.0。

我已经检查了网站文件夹的文件权限(以前也在工作)

部署到之前正在运行的Windows Server 2008 R2,并在网站的根目录上收到错误403 - 禁止访问(我在本地计算机上没有这样做)

到目前为止,我已经尝试过堆栈溢出。有什么想法吗?

这是我的web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
</connectionStrings>
<appSettings>
</appSettings>

<system.web>
  <customErrors mode="Off" />
  <globalization culture="auto" />
  <compilation debug="true" targetFramework="4.6.1" />
  <httpRuntime targetFramework="4.6.1" executionTimeout="45" maxRequestLength="2048000" requestLengthDiskThreshold="512" useFullyQualifiedRedirectUrl="true" enable="true" maxQueryStringLength="1000000" />
  <sessionState mode="InProc" timeout="239" />
  <authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="240" />
</authentication>
</system.web>

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
  </dependentAssembly>
  <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.WebPages" 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.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
  </assemblyBinding>
  </runtime>

  <system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <security>
    <requestFiltering>
    <requestLimits maxAllowedContentLength="2200000000" />
    <!--2GB-->
  </requestFiltering>
  </security>
    <modules runAllManagedModulesForAllRequests="true" />
  <handlers>
  </handlers>
  <staticContent>
remove fileExtension=".woff" />
   <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
   </staticContent>
  </system.webServer>


<entityFramework>
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True" />
  </parameters>
 </defaultConnectionFactory>
</entityFramework>

1 个答案:

答案 0 :(得分:0)

找不到部署目录列表。请检查部署服务器上的目录结构。

确保以下网址正确无误。

<forms loginUrl="~/Account/LogOn" timeout="240" />
相关问题