【问题标题】:ASP.net webdevelopment problem with web.config(?) on IIS7IIS7 上的 web.config(?) 的 ASP.net webdevelopment 问题
【发布时间】: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


【解决方案1】:

首先请探索对 css 文件的响应是什么请求。 (是 404、500、302 响应码)。您可以使用任何 http 观察程序(如 HttpAnalyzer)来完成此操作。

如果 css 文件响应包含请求未授权的信息 - 尝试将 AppPool 设置为经典模式

【讨论】:

  • 看来,如果我在 iis7 中将 .NET 信任级别从“完全内部”更改为高或中(仅尝试了这 2 个),那么它会正确加载。
  • 我认为我的网站项目中的 web.config 是统治网站的那个?
【解决方案2】:
<allow users="*"/> 

改为

<allow users="?"/> 

帮我搞定了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-11
    • 2011-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-20
    相关资源
    最近更新 更多