SignalR between VsCode dev containers using default bridge network - asp.net-core

If I create two ASP Core web services in VsCode and implement a SignalR hub in one which is connected to by the other (Dotnet 5, SignalR client library 5.11). This works fine. I can push these services up to Azure and it still works fine.
If however I open these webservices locally in a VsCode dev container and configure them to connect using the default Docker bridge network and the default forwarded port, I get a Connection Refused exception on the HubConnection.StartAsync call.
Why is this and how do I fix it?
I've tried a few things, using the http and https ports, disabling SSL verification in the client service but nothing works so far. I think I need some information on why this isn't working in the first place before I have much chance of coming up with a solution.

The problem was that that Kestrel was still listening on the default network interface inside the Docker container and I needed to reconfigure it to listen on all interfaces for the connection to work.
So in launchsettings.json I needed to change applicationUrl from "https://localhost:5003;http://localhost:5002" to "https://0.0.0.0:5003;http://0.0.0.0:5002" and then everything worked pefectly.

Related

ASP.NET Core Application registers following url https://gearssdk.opswat.com/ even though I was not registered it

I have noticed that my app is receiving requests to https://gearssdk.opswat.com/ even though I never registered this url
I'm building asp.net core web app with asp.net.core 3.1 framework
screenshot
edit:
this happens both on my PC during debugging and on staging instances
this url is not resolving when app is not running.
It looks to me like your app might be intercepting traffic intended for some security tool that's installed on your machine.
If you run nslookup gearssdk.opswat.com from your machine, you should get a response of 127.0.0.1, which is the local loopback address. You could try listening on a different port

Asp.net core application is not accessible from an external load balanced Azure VM

I have created a VM behind an external load balancer in Azure and I am using IIS as the reverse proxy webserver to host the asp.net core application.
I am able to access the application inside the VM using localhost but not able to access the same from my client machine through the public ip configured for the loadbalancer.
I have configured loadbalancing rules for incoming traffic on port 80 and port 443 for the loadbalancer and specified appropriate NSGs for those ports.
Before deploying the asp.net core application I was able to access the defaultwebsite from my client machine. so I assume that inbound rules are taken in to account and working fine.
This is a self contained application and since I am able to access the application inside the VM through localhost I assume that the aspnet hosting module and other configuration required is proper.
Please let me know if there is anything else I can be missing.
I guess i have figured out what the issue is.
The Loadbalancer probe for the application is configured to be Http since its a webserver and is instructed to check at the default path "/" and since the application i have created does not serve anything on "/" its considering the node as unhealthy and does not respond or serve anything.
I changed the probe to tcp and it works just fine.
Thanks,
Teja

Unable to connect to different HTTP port on server

I am new to WCF Services, I have developed a WCF service library hosted within a Windows Service. The service end point is http://servername:9980/ApplicationServer/ServiceName.
When I run this service on local system and try to connect using my application, everything works fine.
The problem starts when I deploy this service on server system, none of my application can use this service, even the browser says page not found. Though, if I remove the specific port number from the endpoint all works well.
I have already opened all the ports in Windows Firewall including Client and Server. Also proper exceptions are made to the router firewall, still I am not able to host the service on specific port. I have even tried by switching firewall off on both client and server system.
Thank you in advance.
-Ashish Sharma
When you remove the specific port number it defaults to port 80.
So there is something that is blocking the other port.
Try using the Telnet command to check if the port is open (you may have to enable telnet)
As you have allready checked the firewalls, it could be urlscan or a network device.

SignalR: Connection.Start().Wait() hangs the browser indefinitely

I am using ver 0.5.3 of SignalR assembly in my silverlight application. I use connection.Start().wait() to start the connection:
Some of my observations are, which are really strange:
I run the application (In-Browser) mode via Visual Studio and I am able to establish the connection with the SignalR hub
If I deploy the app in IIS and then try accessing the application using the IP address of the machine, the call to connection.start().wait() never returns. I checked the Fiddler and figured out that the call never goes to the SignalR hub
If I use the application in OOB mode (Out of Browser mode), application works without any issue.
My requirement is that it should work in in-Browser mode.
Can somebody throw some light, what could be the issue?
Thanks,
Alpee
It appears to me that you are running into Silverlight's cross-domain request restrictions when run in-browser. You can either host the silverlight application on the same domain that is running SignalR, or you could add a clientaccesspolicy.xml or crossdomain.xml file to the root of the domain running SignalR as suggested in the above link.

WCF client connection problem

I am consuming a web service in .NET application with WCF client.
The Endpoint's address of the service is over port 4338, and it is over HTTPS, secured with WS-Security standard.
So the address is something like :
https://[servername]:4338/[servicename]/
I was not able to communicate to the service with just running the application.
it gave me the following error :
Could not connect to [servername]:4338
TCP error code 10060: 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
[servername]:4338
But when I run Fiddler to investigate the http communication, the application start to work, and I will be able to communicate to the service.
As well, I want to add that I have a different service on the same web server that hosts the first service, and that second service's address is hosted on port 8080, and I am able to communicate with it with WCF client (without running Fiddler).
So, I googled and I found that it might be related to the proxy settings. Do you know what the problem is, and how can I solve it?
Thanks
Fiddler acts as an Internet proxy server. In general, any symptom of the form: "it works when I use Fiddler" means "it works when there's a (different) proxy server".
Check your proxy server settings. In particular, as empi suggested, try it in a browser. If it works there, it could be due to the fact that the browser has the proxy settings configured, and that you do not have them configured for WCF.
If you have proxy set in Internet Explorer, it may cause the problem. What happens when you open https://[servername]:4338/[servicename]/ in Internet Explorer?
Thanks empi for the reply.
I found the answer.
Actually in our company we have a proxy settings through "Automatic configuration script"
and depends on the web sites we are targeting internally, the script will point us to the proper proxy.
So, from the script I got the proper proxy address.
and in my .NET application I added this code
WebRequest.DefaultWebProxy = new WebProxy("http://xx.xx.xx.xx:8080");
and that fixed the problem
So WCF client was not detecting the setting of the automatic script.
and this is the reason it worked when I run Fiddler, because Fiddler listen to the http communication, and send it again through the settings.