【发布时间】:2011-06-22 08:20:00
【问题描述】:
解决方案:<allow users="*"/> 更改为 <allow users="?"/> 对我有用。
当我将我的 asp.net 网站移动到我的网络服务器(Windows Webserver 2008 R2 - IIS7)时,我遇到了一个问题。
我使用 VS2010 并运行项目 asp.net 配置并在我的网站的根文件夹中设置拒绝所有。
然后,当我从外部访问网站时,我被正确转发到 /Account/Login.aspx,但没有加载 css 文件。
所以我在 /Styles 文件夹中添加了一个 allow all 。
还是同样的问题。
如果我登录然后注销 css 似乎会加载..
我真的不知道要在这里寻找什么,是 web.config 问题、iis7 配置问题还是其他什么?
这是位于 /Account/ 的 web.config
<?xml version="1.0"?>
<configuration>
<location path="~/Styles/Site.css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
</configuration>
这是我的网站基础 web.config:
<?xml version="1.0"?>
<configuration>
<location path="~/Styles/Site.css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<connectionStrings>
<remove name="halldbConnectionString"/>
<remove name="ApplicationServices"/>
<add name="ApplicationServices" connectionString="Data Source=xxx.xxx.xxx.xxx;Initial Catalog=xxxxxx;Persist Security Info=True;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient"/>
<add name="halldbConnectionString" connectionString="Data Source=xxx.xxx.xxx.xxx;Initial Catalog=xxxxxx;Persist Security Info=True;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" defaultUrl="~/Väljhall.aspx"
timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<remove name="AspNetSqlMembershipProvider"/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
【问题讨论】:
-
有教程如何从iis6迁移到iis7..
-
您的网站根目录下是否还有另一个 web.config 文件?
-
@ub1k 我没有将它从 iis6 移动到 iis7。
-
@JuliusA 添加了我的基本 web.config
标签: asp.net web-config