使用NET Framework 4.5.2(ASP NET MVC)在IIS中运行应用程序

我在IIS中安装了带有Net Framework 4.5.2(ASP NET MVC)的应用程序,但是它引发了错误,如下所示:

  

启动应用程序时发生错误。
  .NET Core 4.6.28008.02 X64 v4.0.0.0 | microsoft.AspNetCore.Hosting版本2.2.7-servicing-10089 | microsoft Windows 10.0.18362 |需要帮助吗?

重要提示:我的应用程序不是使用net core开发的。它是使用常规Net Framework开发的。 IIS抛出此错误,问题是我不明白为什么。也许您必须在IIS中重新安装Net Framework?

web.config

            <configuration>
          <configSections>
            <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
            <section name="loginSettings" type="System.Configuration.AppSettingsSection,System.Configuration,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
          </configSections>
          <log4net debug="true">
            <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
              <file value="logs\log.txt" />
              <appendToFile value="true" />
              <rollingStyle value="Size" />
              <maxSizeRollBackups value="10" />
              <maximumFileSize value="10MB" />
              <staticLogFileName value="true" />
              <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
              </layout>
            </appender>
            <root>
              <level value="DEBUG" />
              <appender-ref ref="RollingLogFileAppender" />
            </root>
          </log4net>
          <appSettings>
            <add key="webpages:Version" value="3.0.0.0" />
            <add key="webpages:Enabled" value="false" />
            <add key="ClientValidationEnabled" value="true" />
            <add key="UnobtrusiveJavaScriptEnabled" value="true" />
          </appSettings>
          <system.web>
            <compilation targetFramework="4.5.2" />
            <httpruntime />
            <pages controlRenderingCompatibilityVersion="4.0" />
          </system.web>
          <system.webServer>
            <handlers>
              <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
              <remove name="OPTIONSVerbHandler" />
              <remove name="TRACEVerbHandler" />
              <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="system.web.Handlers.TransferRequestHandler" preCondition="integratedmode,runtimeVersionv4.0" />
            </handlers>
          </system.webServer>
          <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
              <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
                <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="system.web.Optimization" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="system.web.Helpers" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="system.web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
              </dependentAssembly>
              <dependentAssembly>
                <assemblyIdentity name="system.web.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
              </dependentAssembly>
            </assemblyBinding>
          </runtime>
          <system.codedom>
            <compilers>
              <compiler language="c#;cs;csharp" extension=".cs" type="microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,microsoft.CodeDom.Providers.DotNetCompilerPlatform,Version=1.0.0.0,PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
              <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
            </compilers>
          </system.codedom>
        </configuration>

但是我的应用程序使用的是Net Framework 4.5.2。在VS 2017中,我的应用程序运行良好。 你能帮助我吗。感谢您的帮助。

t456456 回答:使用NET Framework 4.5.2(ASP NET MVC)在IIS中运行应用程序

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3156061.html

大家都在问