从Windows Server 2008迁移到Windows Sever 2016



我正在尝试为我的一位学校的教授解决一个问题。他有一个C#Web项目,他试图从运行Windows Server 2008的计算机转移到运行Windows Server 2016的较新机器。它正在与IIS一起使用,学生通过自行导航到计算机的IP地址访问该应用程序计算机。

在旧计算机上,他只是将项目文件夹复制到c: inetpub wwwroot中,并且当他从另一台计算机导航到Localhost或他的IP地址时,应用程序就可以运行。但是,当他将项目文件夹复制到C: inetpub wwwroot中时,该项目不运行。反而,这是他得到的屏幕。如果您单击"自动车手"文件夹(这是他要托管的项目文件夹),则会发生此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和Web托管的新手服务器2016。

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

最新更新