如何让我的项目在IIS7服务器上运行?

时间:2018-01-19 18:54:55

标签: asp.net authentication deployment iis-7 web-config

我的ASP.net Web应用程序在我的计算机上运行,​​但在测试或生产服务器上无法正常运行。它重定向到登录页面,而不是允许匿名身份验证。我知道Visual Studio中的项目属性包括匿名身份验证。

这是我的项目属性窗口:

enter image description here

我的web.config文件如下所示:

<?xml version="1.0"?>
<configuration>
    <connectionStrings>
    <!-- Removed for privacy -->
    </connectionStrings>
    <appSettings>
        <!-- Removed for privacy -->
    </appSettings>
    <location path="ResetPassword.aspx">
        <system.web>
            <authorization>
                <allow users="?" />
            </authorization>
        </system.web>
    </location>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <authentication mode="Forms">
            <forms loginUrl="~/Account/Login.aspx" timeout="2880" requireSSL="false" />
        </authentication>
        <webServices>
            <protocols>
                <add name="HttpGet" />
                <add name="HttpPost" />
            </protocols>
        </webServices>
        <membership>
            <providers>
                <clear/>
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="<!-- Removed for privacy -->" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" minRequiredNonalphanumericCharacters="0" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" passwordAttemptWindow="10" applicationName="/" />
            </providers>
        </membership>
        <profile>
            <providers>
                <clear/>
                <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="<!-- Removed for privacy -->" applicationName="/" />
            </providers>
        </profile>
        <roleManager enabled="false">
            <providers>
                <clear/>
                <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="<!-- Removed for privacy -->" applicationName="/" />
                <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
            </providers>
        </roleManager>
    </system.web>
    <system.web.extensions>
        <scripting>
            <webServices>
                <jsonSerialization maxJsonLength="2147483647">
                </jsonSerialization>
            </webServices>
        </scripting>
    </system.web.extensions>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <httpProtocol>
            <customHeaders>
                <clear />
                <add name="X-UA-Compatible" value="IE=edge" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

我还应该提一下,这个web.config文件与当前正在生产中使用的web.config文件相匹配。 应该工作,但我只是不明白IIS中是否有一些其他设置或继承的属性在我的测试服务器上搞乱了。

*更新:我能够在不改变web.config中的任何内容的情况下使该站点在不同的服务器上运行。它必须是服务器配置中的内容。

0 个答案:

没有答案
相关问题