首页 新闻 会员 周边

IIS7.5部署 ASP.NET MVC3.5 访问静态资源报错

0
悬赏园豆:30 [已关闭问题] 关闭于 2012-03-26 16:28

我的系统是windows7,在IIS7上部署MVC3程序,问题如下:

[HttpException (0x80004005): 未能执行 URL。]
System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.BeginExecuteUrl(String url, String method, String childHeaders, Boolean sendHeaders, Boolean addUserIndo, IntPtr token, String name, String authType, Byte[] entity, AsyncCallback cb, Object state) +2446929
System.Web.HttpResponse.BeginExecuteUrlForEntireResponse(String pathOverride, NameValueCollection requestHeaders, AsyncCallback cb, Object state) +417
System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +192
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8967348
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

我的配置文件如下:

1   <system.webServer>
2 <validation validateIntegratedModeConfiguration="false" />
3 <handlers>
4 <add name="MVC" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
5 </handlers>
6 </system.webServer>

handlers是后来加上的,不加的话mvc程序无法运行,加上了程序OK,但是无法访问所有静态资源。

艾民的主页 艾民 | 菜鸟二级 | 园豆:204
提问于:2012-03-26 16:18
< >
分享
所有回答(1)
0

我找到了问题的解决方法,不知道你们的问题出在哪里,我的解决方法是

<system.web>中加入:

1 <httpHandlers>
2 <add verb="*" path="*" type="System.Web.StaticFileHandler" />
3 </httpHandlers>

静态文件及样式文件都能加载了

艾民 | 园豆:204 (菜鸟二级) | 2012-03-26 16:27
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册