我有一个an 4应用程序。当我在Visual 2015上运行它时,它运行得非常完美。当我将它发布到我的本地IIS (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,更改了自动登录到应用程序池。
我真不知道怎么回事,找人帮忙。谢谢:)
发布于 2016-03-17 14:20:05
基于堆栈跟踪,似乎远程web服务器正在响应调用堆栈中显示的应用程序的403。除了权限之外,我能想到的唯一不同之处是,您可能需要打开ASP.NET模拟。当您运行IISExpress或本地时,这些工作进程将在您的帐户上下文下运行。在生产web服务器中运行时,情况并非如此。如果这是IIS 6框,请尝试将ASP.NET模拟添加到应用程序中,如下所示:
<configuration>
<system.web>
<identity impersonate="True" />
</system.web>
</configuration>注意事项
如果您在任何IIS服务器中运行,并且以集成管道模式运行,则还需要将以下内容添加到7.0+文件中:
<system.webServer>
<validation validateIntegratedModeConfiguration="False" />
</system.webServer>如果没有完成,则在启用ASP.NET模拟时会出现错误。希望这能帮上忙。
注2
如果应用程序中没有任何身份验证方法,则需要尝试模拟特定帐户,然后在identity元素中使用userName和密码属性。
https://stackoverflow.com/questions/36035273
复制相似问题