繁体   English   中英

IIS7上带有web.config(?)的ASP.net Web开发问题

[英]ASP.net webdevelopment problem with web.config(?) on IIS7

解决方案: <allow users="*"/>更改为<allow users="?"/>对我有用。

我将asp.net网站移到Web服务器(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>

首先,请浏览对CSS文件的请求进行响应。 (是404、500、302响应代码)。 您可以使用HttpAnalyzer之类的任何http监视程序来执行此操作

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

<allow users="*"/> 

变成

<allow users="?"/> 

为我做了把戏

暂无
暂无

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

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