开发者

N2CMS virtual path provider fails on web server

I'm building a web site with N2 using the NuGet packages (which I'm compiling myself straight from GitHub). The files that make up the management interface in the /N2 folder are all compiled into N2.zip, and there's a virtual path provider configured to serve anything in the /N2 folder from the zip file.

On my development machine, it works perfectly. When I deploy it to the web server (running IIS 6 or IIS 7.5), requests for files in the /N2 folder return with a 404. There is a curious exception: requests with querystring values are served up. For example, /N2/Login.aspx?ReturnUrl=%2fn2 works, but /N2/Resources/Css/All.css does not. (I'm using Fiddler 2 to monitor the requests.)

This is an MVC site, running under .Net 4.0, and not precompiled.

I turned on ASP.Net tracing in web.config, and from that I can see that the VPP is executing, because it writes trace lines starting with ZipVPP:

ZipVPP: False ~/default.cshtml      
ZipVPP: False ~/default.vbhtml  4.79004203405183E-05    0.000048
ZipVPP: False ~/index.cshtml    9.07992130999052E-05    0.000043
ZipVPP: False ~/index.vbhtml    0.000125475536747951    0.000035
ZipVPP: False /Views/Home/Index.aspx    0.000476485344693378    0.000351
ZipVPP: False /Views/Home/Index.ascx    0.000554325119945653    0.000078
ZipVPP: False /Views/Shared/Index.aspx  0.000631632393110378    0.000077
ZipVPP: False /Views/Shared/Index.ascx  0.000704500969472239    0.000073
ZipVPP: False ~/Views/Home/_ViewStart.cshtml    0.000794229163423298    0.000090
ZipVPP: False ~/Views/Home/_ViewStart.vbhtml    0.000833389826910285    0.000039
ZipVPP: True ~/Views/_ViewStart.cshtml  0.000872745800133037    0.000039
ZipVPP: False ~/_ViewStart.cshtml   0.000935947959862434    0.000063
ZipVPP: False ~/_ViewStart.vbhtml   0.000972131211344948    0.000036
ZipVPP: True ~/Views/Shared/_Layout.cshtml  0.00102791407786914 0.000056
ZipVPP: False /Views/Home/LayoutPartials/Rotator.aspx   0.00113080303437734 0.000103

This suggests it might be a bug in the VPP, but I'm not s开发者_如何学Pythonure.


The fix was to configure IIS 6 for wildcard routing, so that all requests, including images, css, script, etc. go through ASP.Net. That give the virtual path provider a chance. Without wildcard routing, IIS will look at the file extension, and for a typically static file type like .jpg or .css, just look for the file in the file system. Since the files aren't there, it returns a 404.

To configure this, see N2CMS virtual path provider fails on web server. Adjust the path to aspnet_isapi.dll to correspond to the .Net version you need, and un-check "check that file exists."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜