简体   繁体   English

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

[英]Migrating Web Application from Windows Server 2008 to Windows Sever 2016

I am trying to solve a problem for one of my professors at school. 我正在努力为我在学校的一位教授解决一个问题。 He has a C# web project that he is trying to move from a computer running Windows Server 2008 to a newer machine running Windows Server 2016. It is being served with IIS and the students access the application by navigating to the computer's IP address from their own computers. 他有一个C#Web项目,他正试图从运行Windows Server 2008的计算机迁移到运行Windows Server 2016的较新计算机。它与IIS一起提供,学生可以通过自己导航到计算机的IP地址来访问该应用程序。电脑。

On the old computer, he simply copied the project folder into C:\\inetpub\\wwwroot and the application just runs when he navigates to localhost or to his IP address from another computer. 在旧计算机上,他只是将项目文件夹复制到C:\\ inetpub \\ wwwroot,并且当他从另一台计算机导航到localhost或IP地址时,该应用程序才运行。 However when he copies the project folder into C:\\inetpub\\wwwroot, the project does not run. 但是,当他将项目文件夹复制到C:\\ inetpub \\ wwwroot时,该项目无法运行。 Instead, this is the screen he gets . 相反, 这是他得到的屏幕 If you click on the 'autograder' folder (which is the project folder he is trying to host), this HTTP error occurs . 如果单击“ autograder”文件夹(这是他尝试托管的项目文件夹), 则会发生HTTP错误 The web.config file is located here - C:\\inetpub\\wwwroot\\autograder\\Bin\\WebApplication1\\WebApplication1\\web.config web.config文件位于此处-C:\\ inetpub \\ wwwroot \\ autograder \\ Bin \\ WebApplication1 \\ WebApplication1 \\ web.config

After looking around online for solutions, I have made sure that the wwwroot folder has the required permissions ( Web.Config - Cannot read configuration file due to insufficient permissions ), but I am not sure why the error says it cannot read the configuration file, nor what is different about Windows Server 2016 that is preventing the project from just running like it did on Windows Server 2008. 在网上寻找解决方案后,我确保wwwroot文件夹具有所需的权限( Web.Config-由于权限不足而无法读取配置文件 ),但是我不确定为什么错误指出它无法读取配置文件, Windows Server 2016的不同之处还在于,它阻止了项目像Windows Server 2008那样正常运行。

Here is the web.config file: 这是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>

I am new to Windows Server, IIS, and web hosting on Windows in general, so I would greatly appreciate any information on why this error is occurring or what changes I may have to make the project to get it to run on Windows Server 2016. 我一般都不熟悉Windows Server,IIS和Windows上的Web托管,因此,我非常感谢您提供任何有关为什么会发生此错误的信息,或者我可能需要进行哪些更改才能使项目在Windows Server 2016上运行。

It turns out that the web.config file itself was the problem. 事实证明web.config文件本身就是问题所在。 I reset the contents of the web.config file and I was able to navigate to the application's home page. 我重置了web.config文件的内容,并且能够导航到应用程序的主页。 After piecing the web.config file back together, I found one set of tags that it didn't like, and that what was why it couldn't read the configuration file properly. 将web.config文件重新拼合在一起后,我发现了一组它不喜欢的标签,这就是为什么它无法正确读取配置文件的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM