Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 承载ASP核心API的IIS_Asp.net_Azure_Iis_Asp.net Core_Windows Server 2012 R2 - Fatal编程技术网

Asp.net 承载ASP核心API的IIS

Asp.net 承载ASP核心API的IIS,asp.net,azure,iis,asp.net-core,windows-server-2012-r2,Asp.net,Azure,Iis,Asp.net Core,Windows Server 2012 R2,我一直在使用的Web API存在以下问题,我的问题在于如何配置Web API以与IIS(Windows Server 2012 R2)一起使用,因为我一直在使用此文档,但仍然出现“此页面无法显示”浏览器错误: Windows服务器托管在Azure上 我甚至添加了与IIS身份验证相关的部分(认为这可能不会导致我的问题),添加/删除它没有任何效果 public void ConfigureServices(IServiceCollection services) { //

我一直在使用的Web API存在以下问题,我的问题在于如何配置Web API以与IIS(Windows Server 2012 R2)一起使用,因为我一直在使用此文档,但仍然出现“此页面无法显示”浏览器错误:

Windows服务器托管在Azure上

我甚至添加了与IIS身份验证相关的部分(认为这可能不会导致我的问题),添加/删除它没有任何效果

 public void ConfigureServices(IServiceCollection services)
    {
        // Add framework services.
        services.AddOptions();

        services.Configure<IISOptions>(options =>
        {
            options.ForwardWindowsAuthentication = false;
        });
     }
这导致了以下文件夹结构

  • 裁判
  • 运行时
  • 大量.dll(对各种程序集的引用,如aspnetcore.mvc、httpclient等)
  • web.config
  • mywebAPI.deps(带依赖项的json文件)
  • mywebAPI.dll
  • mywebAPI.pdb
  • appsettings.JSON
据我所说,我确实想念wwwroot和视图,因为我在我的
project.json
中隐式提到了它们,但我不需要它们,因为我有一个web api而不是web表单应用程序

"publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  }
在IIS上配置步骤 在主驱动器上创建了一个文件夹,我将发布结果放在该文件夹中。 转到IIS管理器并添加了一个新网站 转到应用程序池并将.NET CLR版本设置为“无托管代码”

启动应用程序会使我直接陷入此浏览器错误-无法显示此页面

从CMD dotnet mywebapi.dll运行可以正常工作。。。我已经用Postman(在Windows服务器上安装了Postman)对其进行了测试


您需要更多信息

\logs\stdout
启用并检查应用程序日志



打开FREB并检查日志。您可以发布web.config文件的内容吗?可能有IIS配置问题。嘿,我已经设法解决了。。。。在my launchSettings.json中,我有一个启动URL:。。。在IIS中,我为api选择了一个错误的主机名(而不是本地主机,我写了一些自定义的东西),显然,我在launchSettings.json中写的东西(作为主机)需要(显然…)选择为IIS中的主机名绑定。。。我会尽快发布更新/回复。
"publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  }
<system.webServer>
    <handlers>
      <add 
         name="aspNetCore" 
         path="*" 
         verb="*" 
         modules="AspNetCoreModule" 
         resourceType="Unspecified"/>
    </handlers>
    <aspNetCore 
         processPath=".\MyApp.exe" 
         arguments="%LAUNCHER_ARGS%" 
         stdoutLogEnabled="false"                  <--- enable
         stdoutLogFile=".\logs\stdout" />          <--- set path
  </system.webServer>
</configuration>