IIS(403)禁止

时间:2016-03-16 12:08:22

标签: windows iis server

我有一个asp net 4应用程序。当我在Visual Studio 2015上运行它时,它运行得很好。当我将它发布到我的本地IIS Express(v10)时,它再次运行良好的所有默认配置。但是,当我将它部署到具有IIS 6的生产服务器时,它的运行正常,但我收到以下错误。

Server Error in '/' Application.

The remote server returned an error: (403) Forbidden.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[WebException: The remote server returned an error: (403) Forbidden.]
   System.Net.HttpWebRequest.GetResponse() +8418416
   Truvo.Web.AdvertiserLounge.Controllers.BusinessClaimingController.MakeSearchCall(Boolean advancedSearch, Boolean cache, String view, Int32 log_top_n, String adrecip, Int32 pageSize, Int32 offset, Boolean excludeZone, String what, String where, String locale, Boolean rotate) +925
   lambda_method(Closure , ControllerBase , Object[] ) +679
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +270
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +120
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +452
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +33
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +240
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

我遵循了以下问题:

403 - Forbidden: Access is denied. ASP.Net MVC

我确实添加了IIS_IUSRS,将自动登录更改为应用程序池。

我真的不知道发生了什么事并寻求帮助。谢谢:))

1 个答案:

答案 0 :(得分:0)

基于堆栈跟踪,似乎远程Web服务器正在响应调用堆栈中显示的应用程序403。除了权限之外我唯一能想到的就是你可能需要打开ASP.NET Impersonation。当您运行IISExpress或本地时,这些工作进程在您的帐户上下文中运行。在生产Web服务器中运行时不是这种情况。如果这是一个IIS 6框,请尝试将ASP.NET模拟添加到您的应用程序中:

<configuration>
    <system.web>
        <identity impersonate="True" />
    </system.web>
</configuration>

注意

如果您在任何IIS 7.0+ Web服务器和集成管道模式下运行,您还需要将以下内容添加到web.config文件中:

<system.webServer>
    <validation validateIntegratedModeConfiguration="False" />
</system.webServer>

如果没有完成,启用ASP.NET模拟时会出错。希望这会有所帮助。

注2

如果您的应用程序中没有任何身份验证方法,则需要尝试模拟特定帐户,然后使用identity元素中的userName和password属性。