【问题标题】:MVC asp.net application published :: Error :: 403 - Forbidden: Access is deniedMVC asp.net 应用程序已发布 :: Error :: 403 - Forbidden: Access is denied
【发布时间】:2016-09-20 08:54:55
【问题描述】:

我尝试在我的网站上以 MVC asp.net 发布我的网站,但出现错误:

错误 :: 403 - 禁止访问:访问被拒绝。你没有 使用凭据查看此目录或页面的权限 你提供的。

我也在我的 webconfig 中尝试了很多东西。

<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=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> 
<compilation debug="true" targetFramework="4.6.1" /> 
<httpRuntime targetFramework="4.6.1" /> 
<httpModules> 
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> 
</httpModules> 
<authentication mode="Forms"> 
  <forms loginUrl="Account/Login"></forms> 
</authentication> 
<roleManager enabled="true" defaultProvider="MyProvider"> 
  <providers> 
    <clear /> 
    <add name="MyProvider" type="CampusRiver_Hospital.MyRoleProvider" /> 
  </providers> 
</roleManager> 
</system.web> 
 <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.WebPages" publicKeyToken="31bf3856ad364e35" /> 
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
   </dependentAssembly> 
   <dependentAssembly> 
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> 
    </dependentAssembly> 
    </assemblyBinding> 
  </runtime> 
  <system.codedom> 
 <compilers> 
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> 
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> 
   </compilers> 
 </system.codedom> 
<system.webServer> 
 <validation validateIntegratedModeConfiguration="false" /> 
 <modules runAllManagedModulesForAllRequests="true"></modules> 
 <handlers> 
  <remove name="UrlRoutingHandler" /> 
 </handlers> 
 </system.webServer> 
 <entityFramework> 
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
  <parameters> 
    <parameter value="mssqllocaldb" /> 
   </parameters> 
  </defaultConnectionFactory> 
 <providers> 
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
  </providers> 
  </entityFramework> 
  <connectionStrings> 

   <add name="HospitalContext" connectionString="metadata=res://*/Models.HospitalContext.csdl|res://*/Models.HospitalContext.ssdl|res://*/Models.HospitalContext.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=****;initial catalog=****;user id=*****;password=*****;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
  </connectionStrings> 
  <location path="."> 
   <system.web> 
   <authorization> 
    <allow users="?" /> 
   </authorization> 
   </system.web> 
  </location> 
 </configuration>

【问题讨论】:

  • 也许你在 connectionString 中有错误的数据源?
  • 您运行网站的应用程序池帐户是否有权访问代码所在的文件夹?
  • 我的笔记本电脑上一切正常,只是当我发布它时,它给了我一个错误

标签: asp.net .net asp.net-mvc


【解决方案1】:

运行 IIS 应用程序池的凭据无权访问已部署应用程序的文件夹。尝试在那里提供有效的凭据,该凭据具有适当的访问权限。

转到

应用程序池->选择您的池->高级设置->流程模型->身份

并在这里设置一个有效的身份。

【讨论】:

  • 您好,感谢您的回复。但是我的笔记本电脑上没有安装 IIS 7。我在 arvixe.com 上发布了该网站。尝试从域链接运行网站,但出现错误。 akshigakhar/CampusRiver..我怎样才能在那里做出改变
【解决方案2】:

谢谢,我联系了管理员并设置了用户名和密码。并且成功了。

【讨论】:

    猜你喜欢
    • 2019-02-20
    • 2017-04-28
    • 2015-10-07
    • 2020-07-10
    • 2018-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-31
    相关资源
    最近更新 更多