2

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


'/' 应用程序中的“服务器错误”。

配置错误

说明:处理服务此请求所需的配置文件期间发生错误。请查看下面的具体错误详细信息并适当地修改您的配置文件。

解析器错误消息:在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的部分是错误的。此错误可能是由未在 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>`

请帮我确定问题。

谢谢,森蒂

4

2 回答 2

0

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

于 2013-05-24T05:03:08.087 回答
0

确保您的文件所在的目录可以被 IIS 访问,当 IIS 可以访问该文件夹时会发生此错误。只需更改权限以通过 IUSR 和 IIS_IUSR 访问文件夹

于 2015-04-05T13:23:49.983 回答