c# - <authentication mode ="forms"> Godaddy Hosting 配置错误

标签 c# asp.net iis

我在 Godaddy Hosting 中部署了一个 Web 应用程序,还创建了一个虚拟目录。但是当我尝试通过 URL 访问应用程序时,我收到以下错误

`Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.



源错误:
</assemblies></compilation><authentication mode="Forms"><forms loginUrl="~/Account/LogOn" timeout="2880" /></authentication>
我试图用谷歌搜索它,几乎大多数答案都与虚拟目录有关。我在这里附上了我的 web.config。

我也检查了托管支持,但他们说,这可能是编码错误。所以让我知道,如果我必须考虑其他方面。
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
`<configuration>`
   `<connectionStrings>
    <add name="ApplicationServices" connectionString="data            source=.\SQLEXPRESS;Integrated     Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"     providerName="System.Data.SqlClient" />
    <add name="fbpmProjectDetailsEntities"        connectionString="metadata=res://*/Models.ProjectDetail.csdl|res://*/Models.ProjectDetail.ss    dl|res://*/Models.ProjectDetail.msl;provider=System.Data.SqlClient;provider connection     string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\fbpm.mdf;integrated     security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;"     providerName="System.Data.EntityClient" />
    <add name="fbpmUserEntities"      connectionString="metadata=res://*/Models.UserModel.csdl|res://*/Models.UserModel.ssdl|res:/    /*/Models.UserModel.msl;provider=System.Data.SqlClient;provider connection      string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\fbpm.mdf;integrated     security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;"     providerName="System.Data.EntityClient" />
    <add name="fbpmUserPaySchedEntities"      connectionString="metadata=res://*/Models.UserPaymentSchedule.csdl|res://*/Models.UserPaymentSchedule.ssdl|res://*/Models.UserPaymentSchedule.msl;provider=System.Data.SqlClient;provide    r connection string=&quot;data     source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\fbpm.mdf;integrated security=True;user     instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;"     providerName="System.Data.EntityClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral,     PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral,   PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral,  PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>
    <membership>
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" applicationName="/" />
  </providers>
</membership>
<profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
  </providers>
</profile>
<roleManager enabled="true">
  <providers>
    <clear />
    <add connectionStringName="ApplicationServices" applicationName="/"
      name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
    <add applicationName="/" name="AspNetWindowsTokenRoleProvider"
      type="System.Web.Security.WindowsTokenRoleProvider" />
  </providers>
</roleManager>
<pages>
  <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
  </namespaces>
</pages>
<customErrors mode="Off"/>
  </system.web>
  <system.webServer>
      <modules runAllManagedModulesForAllRequests="false">
          <remove name="FormsAuthenticationModule" />
          <add name="FormsAuthenticationModule"     type="System.Web.Security.FormsAuthenticationModule" />
          <remove name="UrlAuthorization" />
          <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"     />
      </modules>
    <validation validateIntegratedModeConfiguration="false" />
   <!--<modules runAllManagedModulesForAllRequests="true" />-->
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
     </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>`

请帮我确定问题。

谢谢,森蒂

最佳答案

我猜真正的问题是身份验证之前的元素,即编译。这表明 targetFramework 属性实际上可能是罪魁祸首,这本身表明您可能没有将 IIS 应用程序池配置为使用 .NET v4,而是 v2.0

关于c# - <authentication mode ="forms"> Godaddy Hosting 配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16727612/

相关文章:

c# - 在互操作(C++ 托管)项目中使用 C# dll(使用 Microsoft.bcl 构建)

c# - 您如何获得 IsolatedStorage 中所有文件的平面列表?

c# - 在网络浏览器控件中打印谷歌地图 - 不会显示方向线

c# - 如何通过用户名监视文件访问和文件服务器上的更改?

asp.net-mvc - 使用 .net mvc 在 IIS angular 2 应用程序上发布

c# - Asp.Net 中的子命名空间太多? CS0234

c# - 如何在DropDownList控件中列出Active Directory中的所有用户

c# - ASP.NET 应用程序如何检查用于请求的代理?

ssl - 将 SSL 与 IIS 结合使用

c# - 如何使用 WCF Web Api 将集成身份验证用户传递到另一个 Web 服务