C# 将Web应用程序从Windows Server 2008迁移到Windows Server 2016

C# 将Web应用程序从Windows Server 2008迁移到Windows Server 2016,c#,iis,windows-server-2016,C#,Iis,Windows Server 2016,我正试图为我在学校的一位教授解决一个问题。他有一个C#web项目,他正试图从运行Windows Server 2008的计算机转移到运行Windows Server 2016的较新计算机。它由IIS提供服务,学生通过从自己的计算机导航到计算机的IP地址来访问应用程序 在旧计算机上,他只需将项目文件夹复制到C:\inetpub\wwwroot,当他从另一台计算机导航到localhost或他的IP地址时,应用程序就会运行。但是,当他将项目文件夹复制到C:\inetpub\wwwroot时,项目不会运

我正试图为我在学校的一位教授解决一个问题。他有一个C#web项目,他正试图从运行Windows Server 2008的计算机转移到运行Windows Server 2016的较新计算机。它由IIS提供服务,学生通过从自己的计算机导航到计算机的IP地址来访问应用程序

在旧计算机上,他只需将项目文件夹复制到C:\inetpub\wwwroot,当他从另一台计算机导航到localhost或他的IP地址时,应用程序就会运行。但是,当他将项目文件夹复制到C:\inetpub\wwwroot时,项目不会运行。相反 . 如果您单击“自动加载器”文件夹(即他试图承载的项目文件夹),则。web.config文件位于此处-C:\inetpub\wwwroot\autograder\Bin\WebApplication1\WebApplication1\web.config

在联机查找解决方案后,我已确保wwwroot文件夹具有所需的权限(),但我不确定为什么错误显示它无法读取配置文件,也不确定Windows Server 2016与Windows Server 2008有什么不同,它阻止项目像在Windows Server 2008上那样运行

以下是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>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <!-- add System.Data.Entity.Infrastructure.SqlConnectionFactory -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApplication1-20140618141327;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApplication1-20140618141327.mdf" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0" />
    <httpRuntime targetFramework="4.0" />
    <pages>
      <namespaces>
        <!--add namespace="System.Web.Optimization" /-->
      </namespaces>
      <controls>
        <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
      </controls>
    </pages>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
    </authentication>
    <profile defaultProvider="DefaultProfileProvider">
      <providers>
        <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
      <providers>
        <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <roleManager defaultProvider="DefaultRoleProvider">
      <providers>
        <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </roleManager>
    <!--
            If you are deploying to a cloud environment that has multiple web server instances,
            you should change session state mode from "InProc" to "Custom". In addition,
            change the connection string named "DefaultConnection" to connect to an instance
            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      -->
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
      </providers>
    </sessionState>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
    <system.webServer>
        <rewrite>
            <rewriteMaps>
                <rewriteMap name="start">
                </rewriteMap>
            </rewriteMaps>
        </rewrite>
        <defaultDocument>
            <files>
                <add value="Student.aspx" />
                <add value="student" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>


我一般不熟悉Windows Server、IIS和Windows上的web主机,因此我非常感谢您提供有关此错误发生原因的任何信息,或者我可能需要对项目进行哪些更改才能使其在Windows Server 2016上运行。

事实证明,web.config文件本身就是问题所在。我重置了web.config文件的内容,并且能够导航到应用程序的主页。将web.config文件重新拼接在一起后,我发现了一组它不喜欢的标记,这就是它无法正确读取配置文件的原因。

事实证明,web.config文件本身就是问题所在。我重置了web.config文件的内容,并且能够导航到应用程序的主页。将web.config文件重新拼接在一起后,我发现了一组它不喜欢的标记,这就是它无法正确读取配置文件的原因。

您的应用程序池运行在哪个用户下?AUTOGRADER(UOFMICHGANDEARB\boss)。'boss'是此计算机的管理员帐户。您的应用程序池在哪个用户下运行?自动加载器(UOFMICHGANDEARB\boss)。'boss'是此计算机的管理员帐户。