在IIS 8.5上托管Asp.net Core 2.0的问题

时间:2018-08-09 18:05:18

标签: c# iis asp.net-core

我正在设置一个服务器来承载我用asp.net Core 2.0.3制作的应用程序。我将使用IIS 8.5在Windows Server 2012 R2服务器上运行此应用程序。我遵循this Microsoft Tutorial设置环境。

如果我在Power Shell中运行(dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name。它告诉我我正在运行正确版本的运行时环境,并且通过运行dotnet MyProject.dll它可以在5000门上运行该项目,并且可以从服务器访问它。但是,当使用服务器URL访问时,这是我看到的页面: enter image description here

应用程序池的.Net CLR版本设置为“无托管代码”,这是我的Web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
      <rewrite>
         <rules>
            <clear />
            <rule name="Redirect to https" stopProcessing="true">
               <match url=".*" />
               <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
               </conditions>
               <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
            </rule>
         </rules>
      </rewrite>
      <modules runAllManagedModulesForAllRequests="false">
         <remove name="WebDAVModule" />
      </modules>
      <handlers>
         <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments="C:\inetpub\wwwroot\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
      <security>
         <requestFiltering>
            <requestLimits maxAllowedContentLength="3221225472" />
         </requestFiltering>
      </security>
   </system.webServer>
</configuration>

我还试图删除重写规则,并且没有任何更改。而且没有创建错误日志。

我迷失了其他尝试方法。你有什么建议吗?

1 个答案:

答案 0 :(得分:0)

  1. 确保已安装UrlRewrite IIS扩展。
  2. 确保应用程序池标识用户IIS AppPool {AppPoolName}必须对已发布的网站文件夹具有读取权限

转到已发布的网站目录,然后搜索格式为IIS AppPool {AppPool Name}的Application Pool Identity用户,例如IIS AppPool \ DefaultWebsite并授予其读取权限

enter image description here

在IIS管理器中,在左窗格中选择您的网站,然后在右窗格中双击HandlerMappings图标以确保显示处理程序列表。