Can't access my API that was published to IIS (local) - asp.net-core-webapi

It's my first time to publish an ASP.Net Core 2.1 so I'm not quite sure what I'm missing. When I try to just run the API from VS2017, I can access all Requests(CRUD) through POSTMAN or even directly the browser by localhost:1111/api/MyRoute.
After I deployed it in IIS and tried mywebsite.com/api/MyRoute, the request shows correct details of the request in Developer Console > Network but shows error in the console of ERR_CONNECTION_RESET 200 (OK)
I also tried Attaching the process in VS2017 through w3wp.exe still doesn't hit the Get Request
What did I miss?

Are your deploying to your local IIS or remote IIS? it seems more like a connection issue, I would suggest that you call your webapi through ip address instead of domain. ERR_CONNECTION_RESET 200 indicate the connection to your server failed, it may result from DNS failure

Related

Specific IIS user not working with TLS 1.2

We have run into a problem with IIS, TLS 1.2 and domain users. I searched SO and other forums, but all possibly related topics didn't lead me to a solution.
Please don't judge the configuration, it wasn't invented by me, I just need to solve this problem.
What happens is the following:
We have an old web application, that opens an executable with Process.Start and that executable calls an external webservice. This used to work fine with TLS 1.0, but in the near future, the external webservice demands TLS 1.2.
So now we are trying to make this work, and we are almost there: we upgraded the executable's .Net Framework version to 4.7.2 and enabled TLS 1.2 on the Windows Server 2008 R2. The web app's .Net Framework version is set to 4.6.1. It seems to me that this should be everything there is to it.
And indeed, when we run the executable stand alone (not called by the web app) from the server, so owned by the domain user logged on to the server (with RDP), everything works as expected; we receive the proper answer from the web service.
Also, when we call the executable by the web app and in IIS the application pool identity is set to a build in account: ApplicationPoolIdentity, everything works as expected as well.
But, when we set the application pool identity to a dedicated domain account (so a different one than the one that executed the executable earlier), the trouble begins. Connecting the web service fails with the following exception:
System.ServiceModel.EndpointNotFoundException: There was no endpoint
listening at https://<some url>/<some webservice name>.asmx that could
accept the message. This is often caused by an incorrect address or
SOAP action. See InnerException, if present, for more details. --->
System.Net.WebException: Unable to connect to the remote server
---> 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 ...
Now the question is of course, what could be causing this?
I like to believe that the failing domain account is configured correctly, but it seems it is not. Or could it be something else, that I don't even know the existence of...
EDIT:
I managed to narrow it down to a permissions issue: when the dedicated domain account runs the application stand alone, it works as it should. When the dedicated account runs it from within the IIS context (started by the web app), it doesn't work, but when the dedicated account is given admin rights, it also works as expected.
That leaves me to the question: what additional permissions does IIS need to allow this setup? Maybe in combination with TLS 1.2 thingies.
Any help would be greatly appreciated.

SocketException: No connection could be made because the target machine actively refused it XX.XXX.XX.XXX:443

I got 2 servers with two equal wcf services hosted on them and one client application server. I can connect to endpoints and send a requests to both services using test wcf client app (.NET Web Service Studio) from my local machine successfully. But when I am trying to connect from client application server using the same test wcf client app I successfully connected only to the one wcf service server, but I have got an error when connecting to another one:
System.Net.WebException: There was an error downloading 'https://XXX/XXX?wsdl'. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it XX.XXX.XX.XXX:443
I performed netstat -an | find "443" command in command prompt on the client server and on my local machine to find out the difference and here what I have got:
1. On my local machine:
2. On the client app server:
What I already tried to do on client application server is:
- turned off firewall;
- stopped windows firewall service
- uninstalled mcafee virusscan enterprise application.
(I tried to set "prevent mass mailing worms from send mail" first, but mcafee was in foreign language that I don't understand, so I just uninstalled it)
after running command netstat -aon | findstr "443" on client application server I have got this result:
but I still got an error.
Does anybody know how to solve this issue?
Could be the problem on the wcf service server side?
The solution was predictable simple one - firewall was blocking the port,
but it's important to notice that the issue was caused by firewall on the wcf service server side, but not on client application server, which is making the request to that service.
I asked the technical support of that server, and they made firewall changes.
After that error was disappeared.
I faced the same issue and tried different ways to fix this. Nothing works. Later i found the issue which is, the application i tried to run is https and in my IIS, https binding was not created. I created binding https with the website and it works.

Soap error in webservice on one server but not the other

I have an ASP.NET webservice which is deployed on Server2008 IIS7. We use two servers, Production and UAT (test server) and this webservice is deployed on both servers, the same compile is on both of them (no code changes, revisions etc, pure copy/paste from one to another).
The only difference between the applications is a connection string in web.config, one points to PROD database, the other UAT.
If I make a call to the test webservice I get an expected response and all is well, but when I do the same thing on the production webservice I promptly get and error
Server was unable to process request. ---> Object reference not set to an instance of an object.
I am suspecting there must be a configuration issue as the webservices are running under their own Pool which is run by a service account/user (local admin on the servers) and they are set to only run through SSL (https:// only) on a special port.
I tired sniffing with Fiddler and got two identical SOAP requests, the only difference being the server name in URL. I can access the WSDL of both webservices from IE browser, I can successfully refresh my web reference in Visual studio (for both prod and uat services).
Does anyone have any hints what should I be looking at, perhaps someone had a similar problem?
This is resolved. As I suspected the error was in production server configuration. When the sys team added a service user into the local Administrators they added it through Active directory groups, which as I am told requires a logoff/logon or a restart.
Server restart was the solution in my case.

How do I publish ASP.NET MVC3 application to azure using "Publish -> "Web Deploy"? (getting error: Web Deployment task failed)

I'm getting this error when trying to deploy to azure using "Publish" from my MVC project. I checked Web Management Service and Web Deployment Agent Service and there are both running. Credentials I'm using are valid since I get access to server instance through remote desktop
I've also checked values for the properties VS filled for me on the "Publish Web" dialog and they are correct:
Service Url: https://*.cloudapp.net:8172/MsDeploy.axd (where * is my hosted service ID)
Site/Application: NLSubscriber.Web_IN_0_Web
Error 66 Web deployment task failed.(Could not connect to the destination computer (".cloudapp.net"). On the destination computer, make sure that Web Deploy is installed and that the required process ("The Web Management Service") is started.)
This error indicates that you cannot connect to the server. Make sure the service URL is correct, firewall and network settings on this computer and on the server computer are configured properly, and the appropriate services have been started on the server.
Error details:
Could not connect to the destination computer (".cloudapp.net"). On the destination computer, make sure that Web Deploy is installed and that the required process ("The Web Management Service") is started.
Unable to connect to the remote server
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 xxx.xxx.xxx.xxx:8172
0 0 NLSubscriber.Web
I've checked that the service url is reachable (and not blocked by
the firewall), by directly accessing it through my browser typing
just the same address VS is showing and after warning me about the
not trusted certificated, it prompted me for user/password, which I
provided and accessed it with no problem at all.
I've opened Remote Desktop and checked site name from IIS manager,
which is the same as pre-inputted by VS: NLSubscriber.Web_IN_0_Web.
What am I missing?
It seems Arwind has solved this issue on http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/dfe98f28-b211-4124-a505-0c664f48b3e5/
Please check the link and see whether it helps.
Best Regards,
Ming Xu.

WCAT Problem

I am trying to stress test an ASP.Net MVC application using the WCAT tool. I get results when the WCAT client and controller are on the web server(localhost), but when I move the WCAT client to another machine, I get "404 Not found" errors. It seems that the WCAT client cannot make the http requests from the client machine even though if I type in the URL (on the client machine), I can access the website. This should rule out any firewall issues. What else could be the problem?
Found the issue - when starting up the controller you must specify the server hostname (-a) and not "localhost".

Resources