2017-06-29 54 views
0

我部署了一個新的應用程序,其中包含與Web Core API進行通信的Web項目。 我已經使用這個鏈接作爲參考來設置它; https://docs.microsoft.com/en-us/aspnet/core/publishing/iis 在此測試服務器上IIS已經設置了一段時間,所以有些步驟不需要重複。 在IIS中,如果我瀏覽Web API,啓動如下。 enter image description here 但如果我對使用它,我得到這個錯誤的Web項目也這樣做:已部署的Web Core API:響應狀態碼不表示成功:404(未找到)。

Response status code does not indicate success: 404 (Not Found) for a simple get call to the Web API. 

什麼我應該考慮解決這一問題?

回答

1

我發現URI,我需要讓我的應用程序的名稱需要在部署服務器上,而在發展這不是必需的。一旦我做出了修正,它運行良好。

1

多種可能性我看

  • 你只是瀏覽到根網址和你沒有在IIS任何default page setup。要查看Web API,請瀏覽到您在route.config文件中指定的webapi url。

默認路由是這樣的基礎上您的routing .Could您瀏覽到

http://testweb.sherrygreengrp.com/api/<controller>

  • 您沒有在Windows服務器託管捆綁

Install the .NET Core Windows Server Hosting bundle on the hosting system. The bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server. Note: If the system doesn't have an Internet connection, obtain and install the Microsoft Visual C++ 2015 Redistributable before installing the .NET Core Windows Server Hosting bundle

  • ASP.NET CORE Module配置正確。做你在你的web.config有此設置

    <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" /> </system.webServer> </configuration>

+0

好吧,這很有趣。最初有一個web.config下載非常類似於你在這裏發佈的。但是這阻止了我從IIS瀏覽項目,所以我將它重命名爲webx.configx,然後我就可以。根據你的建議,我將它重新命名爲web.config,當我啓動它時,我得到「無法找到該網頁」。在Postman中,當我撥打電話時,我得到一個404,當我啓動使用web api的web項目時,我得到「沒有連接,因爲目標機器主動拒絕它」 – arame3333

+0

這可能是Web API項目是核心項目,而其他使用的項目不是核心項目。 – arame3333

+0

「此網頁無法找到」基本上是404,這是因爲AspNetCoreModule沒有正確連接。是否按照[在此]提到的所有步驟操作(https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/servers/aspnet-core-module) –

相關問題