【问题标题】:Getting blank page after deploying ASP.NET MVC application on IIS在 IIS 上部署 ASP.NET MVC 应用程序后出现空白页
【发布时间】:2020-07-04 19:44:49
【问题描述】:

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

我的 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 中的应用程序是这样的:

但是当我去 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

浏览器控制台是:

【问题讨论】:

  • iis 日志怎么样。那边有记录吗?
  • @DurgaPrasad 在问题中添加了日志文件内容
  • 浏览器控制台是否出现错误?
  • 您在访问指定的 url 时收到 500 服务器错误。那边没什么。你可以创建一个新网站并在不同的端口上运行它,看看它是否有效。
  • 500 始终是服务器问题。这意味着您必须查看日志服务器端。但这可能是由于客户端传递了错误的参数引起的。您的跟踪不喜欢 2 个获取请求。您的 iis 日志可以提供帮助,但最好的检查位置是事件日志。

标签: c# asp.net-mvc iis


【解决方案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. 在网络服务器机器上打开 IIS 控制台。

  2. 双击错误页面选项:

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

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

5)重启iis。

【讨论】:

    【解决方案2】:

    您可以尝试将网络服务用户帐户添加到 IIS 中的 DefaultWebSite AppPool 的身份。并且与具有所有权限的应用程序根文件夹相同。 让我知道浏览器网络选项卡中发生的情况。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-17
      • 1970-01-01
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 2011-06-21
      • 2022-11-10
      • 1970-01-01
      相关资源
      最近更新 更多