在IIS上部署ASP.NET MVC应用程序后获取空白页

时间:2020-07-04 19:44:49

标签: c# asp.net-mvc iis

我已经在Windows 10系统IIS上部署了ASP.NET MVC应用程序。我已完全授予根文件夹和web.config文件的 IIS_IUSRS 。即

enter image description here

我的web.config是:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <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" />
      <add key="ApiBaseUrl" value="http://localhost:61681/api/" />
  </appSettings>
  <system.web>
      <compilation targetFramework="4.6.1" />
      <httpRuntime targetFramework="4.6.1" />
      <pages>
          <namespaces>
              <add namespace="Online.Common.Admin" />
          </namespaces>
      </pages>
  </system.web>
  <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
              <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" />
              <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
          </dependentAssembly>
          <dependentAssembly>
              <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
              <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.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.6.5135.21930" newVersion="1.6.5135.21930" />
          </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.4.0" newVersion="5.2.4.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=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" warninglevel="4" compileroptions="/langversion:default /nowarn:1659;1699;1701" />
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="microsoft.codedom.providers.dotnetcompilerplatform.vbcodeprovider, microsoft.codedom.providers.dotnetcompilerplatform, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" warninglevel="4" compileroptions="/langversion:default /nowarn:41008 /define:_mytype=\&quot;web\&quot; /optioninfer+" />
      </compilers>
  </system.codedom>
</configuration>
<!--ProjectGuid: E2BBCD58-DEC6-4A53-9CFE-FCFA11E6EBDB-->

IIS中的应用程序如下:

enter image description here

但是当我进入 http:// localhost / test123123 时,我得到了一个空白页。可能是什么问题,我已经坚持了5个小时。

在日志中,我有这个:

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2020-07-04 18:16:33
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2020-07-04 18:16:33 192.168.10.8 GET /bmlinks/ddf.xml - 80 - 192.168.10.8 avast!+Antivirus - 404 0 64 11900
2020-07-04 18:16:33 192.168.10.8 GET /upnp/BasicDevice.xml - 80 - 192.168.10.8 avast!+Antivirus - 404 0 64 9898
2020-07-04 18:16:34 192.168.10.8 GET / - 80 - 192.168.10.8 avast!+Antivirus - 200 0 64 29749
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2020-07-04 18:39:05
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2020-07-04 18:39:05 ::1 GET / - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/83.0.4103.116+Safari/537.36 - 200 0 0 3613
2020-07-04 18:39:05 ::1 GET /iisstart.png - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/83.0.4103.116+Safari/537.36 http://localhost/ 200 0 0 43
2020-07-04 18:39:05 ::1 GET /favicon.ico - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/83.0.4103.116+Safari/537.36 http://localhost/ 404 0 2 4
2020-07-04 18:47:30 ::1 GET /test123123 - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/70.0.3538.102+Safari/537.36+Edge/18.18362 - 500 19 5 87
2020-07-04 18:51:51 ::1 GET /test123123 - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/70.0.3538.102+Safari/537.36+Edge/18.18362 - 500 19 5 1

浏览器控制台为:

enter image description here

2 个答案:

答案 0 :(得分:1)

您收到错误500.19,这是配置错误。这意味着您的web.config文件有问题。

您可以尝试从web.config文件中删除以下代码:

    <system.codedom>
      <compilers>
          <compiler language="c#;cs;csharp" extension=".cs" type="microsoft.codedom.providers.dotnetcompilerplatform.csharpcodeprovider, microsoft.codedom.providers.dotnetcompilerplatform, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" warninglevel="4" compileroptions="/langversion:default /nowarn:1659;1699;1701" />
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="microsoft.codedom.providers.dotnetcompilerplatform.vbcodeprovider, microsoft.codedom.providers.dotnetcompilerplatform, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" warninglevel="4" compileroptions="/langversion:default /nowarn:41008 /define:_mytype=\&quot;web\&quot; /optioninfer+" />
      </compilers>
  </system.codedom>

如果您仍然面对并提出问题,请在iis中为您的网站启用详细错误。

  1. 在Web服务器计算机上打开IIS控制台。

  2. 双击“错误页面”选项:

enter image description here

  1. 选择“编辑功能设置...”选项:

enter image description here

  1. 将默认设置从第三个选项“本地请求的详细错误”和“远程请求的自定义错误页面”更改为第二个选项“详细错误”:

enter image description here

5)重新启动iis。

答案 1 :(得分:0)

您是否可以尝试将网络服务用户帐户添加到IIS中的DefaultWebSite AppPool身份。并与具有所有权限的应用程序根文件夹相同。 让我知道浏览器网络标签中会发生什么。