我创建了一个ASP.Net MVC项目,当我部署并发布此项目时,默认页面将加载并且看起来工作正常,但是,如果我尝试离开任何其他URL,我会收到403错误。我检查了IIS事件日志,并在我点击链接的任何时候找到了这个。
> Event code: 3005 Event message: An unhandled exception has occurred.
> Event time: 5/16/2017 1:46:04 PM Event time (UTC): 5/16/2017 6:46:04
> PM Event ID: 9d8a7e9c041b462c9915b24fd7f941db Event sequence: 8
> Event occurrence: 2 Event detail code: 0 Application information:
> Application domain: /LM/W3SVC/7/ROOT/test/CC-6-131394337509150873
> Trust level: Full
> Application Virtual Path: /test/CC
> Application Path: D:\zrodelta\dev\test\CC\
> Machine name: JBISVR4 Process information:
> Process ID: 156
> Process name: w3wp.exe
> Account name: IIS APPPOOL\CreditCard Exception information:
> Exception type: HttpException
> Exception message: Server cannot append header after HTTP headers have been sent. at System.Web.HttpResponse.AppendHeader(String
> name, String value) at
> System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase
> httpContext, IController& controller, IControllerFactory& factory)
> at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase
> httpContext, AsyncCallback callback, Object state) at
> System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
> Boolean& completedSynchronously)
>
> Request information:
> Request URL: https://zrodelta.com:443/test/CC/Home/About
> Request path: /test/CC/Home/About
> User host address: 192.168.125.57
> User:
> Is authenticated: False
> Authentication Type:
> Thread account name: IIS APPPOOL\CreditCard Thread information:
> Thread ID: 38
> Thread account name: IIS APPPOOL\CreditCard
> Is impersonating: False
> Stack trace: at System.Web.HttpResponse.AppendHeader(String name, String value) at
> System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase
> httpContext, IController& controller, IControllerFactory& factory)
> at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase
> httpContext, AsyncCallback callback, Object state) at
> System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
> at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
> Boolean& completedSynchronously)
> Custom event details:
我没有更改任何默认设置,并且在创建模板时将所有内容都保留了下来。我使用Web部署,一切似乎都有效。我听说它与我的路由有关,或者可能与标题有关。但我完全迷失了。
任何帮助都会受到高度赞赏,因为我被困住了。我遵循了大多数正常的步骤,例如确保权限,检查框架版本等。我觉得它是我的代码中的某些东西,或者我在服务器上遗漏的东西,无论它是什么,我确定它是一个小设置,我需要改变,我只是不知道它是什么。顺便说一下,该项目是一个ASp.Net 4.5.2项目。
创建没有身份验证的新项目后。这仍然在事件查看器中显示为问题:
事件代码:3005事件消息:发生了未处理的异常。 活动时间:5/16/2017 2:49:10 PM活动时间(UTC):5/16/2017 7:49:10 PM事件ID:a21d9a3b87f34c8090c7b1e36394c85b事件序列:14 事件发生:1事件详细信息代码:0应用程序信息: 应用领域:/ LM / W3SVC / 7 / ROOT / test / CC-3-131394377202796591 信任等级:完整 应用程序虚拟路径:/ test / CC 应用程序路径:D:\ zrodelta \ dev \ test \ CC \ 机器名称:JBISVR4过程信息: 进程ID:1312 进程名称:w3wp.exe 帐户名称:IIS APPPOOL \ ASP.NET v4.0异常信息: 异常类型:HttpException 异常消息:在发送HTTP标头后,服务器无法追加标头。在System.Web.HttpResponse.AppendHeader(String name,String value)at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext,IController&控制器,IControllerFactory&厂)
在System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase) httpContext,AsyncCallback回调,对象状态)at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤, 布尔和放大器; completedSynchronously)Request information: Request URL: https://zrodelta.com:443/test/CC/Home/About Request path: /test/CC/Home/About User host address: 192.168.125.57 User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\ASP.NET v4.0 Thread information: Thread ID: 12 Thread account name: IIS APPPOOL\ASP.NET v4.0 Is impersonating: False Stack trace: at System.Web.HttpResponse.AppendHeader(String name, String value) at
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext,IController&控制器,IControllerFactory&厂)
在System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase) httpContext,AsyncCallback回调,对象状态)at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤, 布尔和放大器; completedSynchronously) 自定义活动详情:
答案 0 :(得分:1)
所以我终于弄明白了这个问题。随着所有的解决方案在线没有任何工作,我终于弄清楚,这是因为我想在与Wordpress网站相同的位置软管这个网站。我不知道这一点,但Wordpress for SEO友好URL有一个URL Rewrite功能。我将我的新文件夹添加到排除规则和bam,这一切都有效。谢谢你的帮助!