C# MVC 4.0 Web应用程序部署问题

C# MVC 4.0 Web应用程序部署问题,c#,asp.net-mvc,entity-framework,iis,C#,Asp.net Mvc,Entity Framework,Iis,嗨,我一直在web服务器上部署我的web应用程序。我有一个托管服务,其中有IIS 7.5和框架是4.0。当我尝试部署我的应用程序时,它会给我配置错误,我不知道为什么它会给我这个错误 我昨天在stack overflow上搜索了很多,但是所有的答案都不适用于我,所以这就是我在这里发布的原因。我的Web.Config文件如下 <?xml version="1.0" encoding="utf-8"?> <!-- For more information on ho

嗨,我一直在web服务器上部署我的web应用程序。我有一个托管服务,其中有IIS 7.5和框架是4.0。当我尝试部署我的应用程序时,它会给我配置错误,我不知道为什么它会给我这个错误

我昨天在stack overflow上搜索了很多,但是所有的答案都不适用于我,所以这就是我在这里发布的原因。我的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=169433
    -->
    <configuration>

  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="DBConString" value="Data Source=WINCTRL-CHG6UME;
    Initial Catalog=xxxxx; Persist Security Info=True; User ID=xxxx; Password=xxxx" />
    <add key="DBConString" value="Data Source=WINCTRL-CHG6UME; Initial 
    Catalog=CraigsList; Persist Security Info=True; User ID=xxx; Password=xxxx" />
  </appSettings>
  <connectionStrings>
    <add name="CraigsListCNS" connectionString="Data Source=WINCTRL-CHG6UME; Initial 
    Catalog=xxx; Persist Security Info=True; User ID=xxx; Password=xxx" 
    providerName="System.Data.SqlClient" />
    <add name="xxxx" connectionString="Data Source=WINCTRL-CHG6UME; Initial 
     Catalog=xxx; Persist Security Info=True; User ID=xxx; Password=xxx" 
     providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <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>

    <!-- Custom Membership Provider Goes Here -->
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>

    <membership defaultProvider="MyMembershipProvider">
      <providers>
        <clear />
          <add name="MyMembershipProvider" 
          type="CraigsList.Buisness.CustomMebershipProvider"
               connectionstringname="ApplicationServices"
               maxinvalidpasswordattempts="5"
               minrequiredpasswordlength="6"
               minrequirednonalphanumericcharacters="0"
               applicationName="CraigsList" />
      </providers>
    </membership>


    <!-- Custom Role Provider Goes Here -->
    <roleManager enabled="true" defaultProvider="MyRoleProvider">
      <providers>
        <clear />
        <add name="MyRoleProvider" type="CraigsList.Buisness.CustomRoleProvider"/>
      </providers>
    </roleManager>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." 
      verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" 
      scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" 
      preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" 
      />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." 
      verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" 
      scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" 
      preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"  
      />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." 
      verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" 
      type="System.Web.Handlers.TransferRequestHandler" 
      preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory 
    type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" 
  type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

我得到的错误在这一行

<authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>


在应用程序级别之外使用注册为allowDefinition='MachineToApplication'的节是错误的。此错误可能是由于未将虚拟目录配置为IIS中的应用程序而导致的。

那么,您的虚拟目录在IIS中是如何配置的?我是第一次部署它,所以不知道您的web服务器上是否安装了itis MVC4?您是否有访问Internet信息服务(IIS)的权限服务器上的经理?我发现这是个愚蠢的错误。我只是没有使子文件夹成为服务器上的虚拟目录。