1
votes

new ASP.Net Core dev here. I have background in developing in Java and .Net framework 4.5, and am running into an issue with hosting an ASP.Net Core application in IIS (8.5). I have a asp.net 2.2 application (with razor) that utilizes the RestSharp lib to make a REST API call to an exposed endpoint (uses Basic authentication) and collects/displays the data. This works without issue locally from VSCode. However, when I publish the project to IIS and the clr runs and loads the page, but the api call fails with the following exception:

Response Exception: System.Net.WebException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

I had been using the tutorial here for IIS hosting of an InProcess hosting model. I have fiddler on the server as well and can make the same call manually, so I don't think it's a firewall issue. I think it's something to do with how .net core interacts with IIS and Basic Authentication.

Is there anything specific that needs be done with ASP.NET Core in IIS to execute REST calls?

1
blog.lextudio.com/… Typical differences still apply. Can you try to use another account as pool identity and try again? Tools like Wireshark can also help.Lex Li
Great stuff Lex! Thank you.ncecconi

1 Answers

0
votes

I got it sorted. I needed to provide a proxy value to the RestSharp Client object to get the request out of our company servers. The fiddler call worked without issue because it used the system proxy, but I needed to set explicitly for the client.