Web.config 位置标记在部署到服务器时停止工作
非常感谢。运行 ASP.NET 开发服务器时,一切正常。但是,当我将 asp.net 应用程序部署到生产服务器(IIS 7.0 集成模式,全新安装)时,web.config 文件中的位置标记将被忽略。
举个例子:我正在使用表单身份验证,当用户到达我的 login.aspx 页面时,外部 css & js 文件没有被加载...即使我已经指定这些文件应该可供所有用户使用(无论是否经过验证)。 但是,一旦用户登录,文件实际上就会加载。
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<authorization>
<deny users="?" /> <!-- Restrict anonymouse user access -->
</authorization>
我的 css 文件例外...
<location path="Styles/xtools.css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
我已经验证了 css 文件的路径是准确的。有什么建议吗?
谢谢,--丹
--编辑 忘了提及,我也尝试在目标文件夹中创建一个 web.config 文件......仍然不起作用。
Many thanks in advance. When running the ASP.NET Development Server, everything is working fine. However, when I deploy my asp.net application to the production server (IIS 7.0 integrated mode, fresh install), my location tags in my web.config file are being ignored.
Case in point: I'm using forms authentication, and when the user arrives at my login.aspx page, the external css & js files are not being loaded...even though I have specified that those files should be available to all users (auth'd or not). However, once the user is logged in, the files do in fact load.
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<authorization>
<deny users="?" /> <!-- Restrict anonymouse user access -->
</authorization>
And the exception to my css file...
<location path="Styles/xtools.css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
I've verified that the path to the css file is accurate. Any suggestions?
Thanks, --Dan
--EDIT
Forgot to mention, I have tried creating a web.config file in the targetted folder as well...still not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
刚刚收到。授予包含应用程序的文件夹的 IIS_IUSRS 权限是不够的...我还需要授予 IUSR 权限。
问题解决了。谢谢,本夫!
Just got it. It wasn't enough to give IIS_IUSRS permissions on the folders containing the app ...I needed to give IUSR permissions, as well.
Problem solved. Thanks, ben f!