简体   繁体   English

尽管我尝试停止它,但IIS仍在提供静态文件

[英]IIS serving static files despite my attempts to stop it

So, I've been working on project that's making use of the Katana/Owin pipeline. 因此,我一直在研究利用Katana / Owin管道的项目。 And I'm trying to use Owin to serve static files securely. 而且我正在尝试使用Owin安全地提供静态文件。 Now, when I run the project locally through VS, everything works perfectly fine. 现在,当我通过VS在本地运行项目时,一切工作都很好。

However, when I deploy it to a server (Windows Server 2008 R2, IIS 7), IIS has decided that it'll be damned before it lets any dirty managed handler manage its static files. 但是,当我将其部署到服务器(Windows Server 2008 R2,IIS 7)时,IIS决定在允许任何脏的托管处理程序管理其静态文件之前将其损坏。 Even when I've removed the static file handler. 即使我删除了静态文件处理程序。 Even when I've added my own handler for a specific path. 即使我已经为特定路径添加了自己的处理程序。 Even when I've told it to run All Managed Modules For All Requests. 即使我已经告诉它运行“所有请求的所有托管模块”。 And since the path that's being passed in is a virtual path, IIS of course craps out and dies and either spits out a 500 or a 404 error. 而且由于传入的路径是虚拟路径,因此IIS当然会崩溃并死掉,并抛出500或404错误。 I'm not entirely sure what causes it to spit out a 500 over a 404, but anytime the request is deeper than 1 directory deep it gives out a 500 over 404. (/Client/Content/Folder/static.html(404) vs /Client/Content/Folder/SubFolder/static.html (500)) 我不确定是什么原因导致它在404上吐出500,但是只要请求的深度大于1目录,它就会在404上吐出500。(/Client/Content/Folder/static.html(404)与/Client/Content/Folder/SubFolder/static.html(500))

I'm just not sure where to go from here, at all. 我只是不确定从这里到底要去哪里。 Worse still, when I've deployed to my local IIS (not running it out of VS, that is.) it works perfectly. 更糟糕的是,当我部署到本地IIS(不是在VS中运行它)时,它会完美地工作。 It respects the web.config, the Owin middleware handles the static requests perfectly, the security is in place. 它尊重web.config,Owin中间件完美地处理了静态请求,安全性到位。 Everything is peachy. 一切都是桃子。 Granted I'm running IIS 8 express on my box, but I'm not convinced that that is it. 当然,我在盒子上运行IIS 8 Express,但是我不相信就是这样。

I'm going to post my comment as an answer since the more I think about it, the more sure I am that it could be the issue. 我将发表评论作为答案,因为我对它的思考越多,我就越确定这可能是问题。

Check that all necessary asp.net and IIS features have been installed correctly via Programs and Features - do a comparison between your dev and server environments. 检查是否已通过“程序和功能”正确安装了所有必需的asp.net和IIS功能-在开发环境和服务器环境之间进行比较。 I've experienced essentially the same issues as yourself and this was usually the reason. 我遇到了与您基本相同的问题,这通常是原因。

If this isn't the reason, check the IIS settings/Application pool settings make sure they are the on dev and production environments. 如果不是这个原因,请检查IIS设置/应用程序池设置,确保它们在开发环境和生产环境中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM