UseProxyToSpaDevelopmentServer problem angular 11 .net core - .net-core

Ive just taken over an app that has this line of code in startup.cs
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200")
when the app runs, I get this error
HttpRequestException : no connection could be made because the target machine actively refused it
Failed to proxy the request to http://localhost:4200 because the request to the proxy target failed: check that the proxy target server is running and accepting requests to http://localhost:4200
I had initially thought this was a sql server error , its similar in syntax to a sql network error, but after some searching its down to spa architecture/design ?
What should the proxy server be ? Am I missing the activation of a server somewhere ?
Im using .net core 3 and angular 11 (which im new to)
thanks in advance for any help

When using UseProxyToSpaDevelopmentServer during development you need to start the angular app as another process at that address- usually this just means npm run start in the angular apps directory.

Related

grpc in a ASP core host: context deadline exceeded

I am trying to connect to a grpc service in a ASP Core application that is in a windows 10 computer.
I want to connect with grpui. If I run grpcui in the same computer, without TLS, I can use this way:
grpcui -plaintext localhost:5110
Then I would like to connect from another computer (a virtualbox windows 10). So I use this command:
grpcui -plaintext 192.168.1.2:5110
But I get an error that tells "context deadline exceeded".
If I disabled the firewall in the service computer, then I get another error: "No connection could be made because the target machine actively refused it.". So the problem it seems that firewall in the server computer.
NOTE: I will not pay attention to this second error, I would like to solve first the first one. Later if I need, I will open another question for that, to avoid to mix two different problems in one question.
Then I have add 2 rules in the outbunds, one for the .exe file of the asp application and another for the conhost.exe file in windows\system32. This is because in the taskmanager it seems these are the 2 files that is running when I run the ASP application. I do the same for the inbounds rules.
But the problem is the same.
So which are the rules that I have to set in the firewall to can allow to connect to the service?
Thanks.

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.

SignalR not working in Windows Serrver R2 2012

I tried a sample app using signalR as per the below guide..
https://learn.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-3.1&tabs=visual-studio
The sample app works fine in local machine and even in DEV server .
UAT server it is not working .
UAT server configuration
OS: Windows server R2 2012
IIS version : 8.5
Application :Dot net
Framework : Asp . net core 2.0
Issue :
The signal demo app is working in visual studio .When i hosted to IIS . it is not working .The issue i am facing is the following :
signalr.js:3082 [2020-08-31T07:17:32.162Z] Error: Connection disconnected with error 'Error: Server timeout elapsed without receiving a message from the server.'.
Chat.js:19 Error: Server timeout elapsed without receiving a message from the server.
console error screenshot:
enter image description here
I have enabled Web socket protocol in add feature menu.
Did i missing any thing? For some reason it couldn't able to connect to the hub.
You can try to increase Javascript client timeout.
hubConnection.serverTimeoutInMilliseconds = 100000; // 100 second
If signalR got disconnected, you should try re-establishing the connection again. The connection could drop for several other reasons, including the user switching networks. For example if the user is using a cell-phone and connected to the home/office wifi but steps out which then connects to cellular data connection.
You can also refer to below links of a similar case with the issue:
How to increase timeout setting in ASP.NET Core SignalR v2.1?

Can't access my API that was published to IIS (local)

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

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.

Resources