簡體   English   中英

將Web應用程序從Windows Server 2008遷移到Windows Sever 2016

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

我正在努力為我在學校的一位教授解決一個問題。 他有一個C#Web項目,他正試圖從運行Windows Server 2008的計算機遷移到運行Windows Server 2016的較新計算機。它與IIS一起提供,學生可以通過自己導航到計算機的IP地址來訪問該應用程序。電腦。

在舊計算機上,他只是將項目文件夾復制到C:\\ inetpub \\ wwwroot,並且當他從另一台計算機導航到localhost或IP地址時,該應用程序才運行。 但是,當他將項目文件夾復制到C:\\ inetpub \\ wwwroot時,該項目無法運行。 相反, 這是他得到的屏幕 如果單擊“ autograder”文件夾(這是他嘗試托管的項目文件夾), 則會發生HTTP錯誤 web.config文件位於此處-C:\\ inetpub \\ wwwroot \\ autograder \\ Bin \\ WebApplication1 \\ WebApplication1 \\ web.config

在網上尋找解決方案后,我確保wwwroot文件夾具有所需的權限( Web.Config-由於權限不足而無法讀取配置文件 ),但是我不確定為什么錯誤指出它無法讀取配置文件, Windows Server 2016的不同之處還在於,它阻止了項目像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文件重新拼合在一起后,我發現了一組它不喜歡的標簽,這就是為什么它無法正確讀取配置文件的原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM