I deployed an Asp.Net Web API project on Amazon Web Services' Elasticbeanstalk (IIS configured machine). Everything works fine except WebSocket. To test the WebSocket easier I use Simple WebSocket Client extension on Chrome.
When I make a request to the API, I get the following (error) message (I observe this message over developer console's network tab):
WebSocket connection to 'ws://my_url' failed: Error during WebSocket handshake: Unexpected response code: 400
I have not found enough information to overcome this problem.
I tried enabling all Inbound/Outbound TCP connections from all ports and all IPs under Security Groups.
I tried creating an empty Asp.Net Web API project that only has a basic sample of WebSockets (just sending a message to the connected user) and deploying it to a brand new environment and application on AWS.
Nothing has worked so far.
I am using Microsoft's WebSockets, .NET Framework 4.5.1.
What are the possible solution ways?
If you are using AWS Elastic Load Balancer in your elastic beanstalk then ELB does not support web sockets and you have to apply a work around. Change your Load Balancer top classic load balancer that supports Websockets.
https://aws.amazon.com/blogs/aws/new-aws-application-load-balancer/
I solved the problem by adding All TCP on Inbound segment of Security Groups and using the IP address of the server instead of AWS created name.
Related
I have a Python gRPC server running on AWS Fargate (configured very similar to this AWS guide here), and another AWS Fargate task (call it the "client") that attempts to make a connection to my gRPC server (also using Python gRPC). However, the client is unable to make a call to my server, with the following error:
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"#1619057124.216955000","description":"Failed to pick subchannel",
"file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":5397,
"referenced_errors":[{"created":"#1619057124.216950000","description":"failed to connect to all addresses",
"file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc",
"file_line":398,"grpc_status":14}]}"
Based on my reading online, it seems like there are myriad situations in which this error is thrown, and I'm having trouble figuring out which one pertains to my case. Here is some additional information:
When running client and server locally, I am able to successfully connect by having the client connect to localhost:[PORT]
I have configured an application load balancer target group following the guide from AWS here that makes health check requests to the / route of my gRPC server, using the gRPC protocol, and expect gRPC response code 12 (UNIMPLEMENTED); these health check requests are coming back as expected, which I believe implies the load balancer is able to successfully communicate with the server (although I could be misunderstanding)
I configured a service discovery system (following this guide here) that should allow me to reach my gRPC server within my VPC via the name service-name.dev.co.local. I can confirm that the corresponding DNS record exists in Route 53, and when I SSH into my VPC, I am indeed able to ping service-name.dev.co.local successfully.
Anyone have any ideas? Would appreciate any and all advice, and I'm happy to answer any further questions.
Thank you for your help!
on your grpc server use 0.0.0.0:[port] and expose this port with TCP on your container.
A client is running our C# gRPC client on a corporate network, behind an HTTP proxy. The http_proxy environment variable is configured, but nevertheless he sees an error message Name resolution failure when attempting to connect to the server on the internet.
DNS resolution from the same machine works fine using nslookup.
Any ideas what I can do to investigate this problem?
You can use the following three lines at application startup to configure the detailed logging that #JanTattermusch suggested:
Environment.SetEnvironmentVariable("GRPC_TRACE", "api");
Environment.SetEnvironmentVariable("GRPC_VERBOSITY", "debug");
Grpc.Core.GrpcEnvironment.SetLogger(new Grpc.Core.Logging.ConsoleLogger());
In order to connect a C# gRPC client on a corporate network, behind an HTTP proxy, add this on the client main method works:
Environment.SetEnvironmentVariable("NO_PROXY", "127.0.0.1");
I have created Scheduler Job in Azure using HTTPS action to periodically ping ASP.NET Web application deployed on VM. Web application is configured with HTTPS binding using SSL certificate. I have configured IIS security using IIS Crypto 2.0 tool.
Scheduler Job fails with an error:
Http Action - Request to host 'www.somesamplehost.com' failed: SendFailure The
underlying connection was closed: An unexpected error occurred on a
send.
The same URL works fine when I try to access it from any browser.
Screenshot from Azure Portal:
The issue was due to SSL certificate. I have ECC SSL certificate for my Web Application and Azure Scheduler Job does not support making requests to Web Application that has that kind of certificate.
Guys from MS suggested alternative for Scheduler Job. It is a feature in Azure Portal called "Logic Apps". You can set it up in a way that it periodically makes requests to specific URL, but "Logic Apps" has much more capabilities compared to Scheduler Job.
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.
I'm running my ASP.NET Web API app locally with xsockets without any problems. When I publish the project to Azure, it won't connect. I enabled websockets for Azure and adjusted the xsockets url on the client side
from:
conn = new XSockets.WebSocket("ws://localhost:50838/api/Chat");
to:
conn = new XSockets.WebSocket("ws://.azurewebsites.net/api/Chat");
Any suggestions?
Arnoud
XSockets passes in the subprotocol 'XSocketsNET' by default and for some reason Azure is filtering this away in the response. It works fine in emulation but on Azure the sub-protocol is removed. This causes errors in Chrome since chrome checks the subprotocol giving the error below:
WebSocket connection to 'ws://xmvc.azurewebsites.net/Home' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
It works fine in other browser that does not perform this check. I've tried IE10 and Firefox on this sample site running XSockets on a Azure WebSite
In my opinion Chrome is doing the correct thing and Azure has a bug.
EDIT:
Be aware of the fact that Azure WebSites limits websocket connections!!!
Free site: 5 connections
Shared site: 35 connections
Standard site: 350 connections
According to Microsoft using WebSockets over Wss / Https will do the trick, i just done a test and the result is still the same.
Most likely the "unnecessary" sub-protocol header is removed from the response event if you pass is from server during the hand-shake.
So, You cannot rely on the SubProtocol when using Windows Azure as it seems?