I have a legacy application server built using .NET remoting over TCP in a Windows service. I want to introduce some OWIN dependent frameworks, like WebAPI and SignalR without requiring a new port.
My attempts to register both .NET remoting and OWIN on the same port have thus far failed.
If I start OWIN first, the remoting configuration fails with a System.Runtime.Remoting.RemotingException "An attempt was made to access a socket in a way forbidden by its access permissions".
If I start remoting first, then OWIN startup fails with a System.Net.HttpListenerException "The process cannot access the file because it is being used by another process".
This doesn't surprise me. But the question remains, is there a way to make this configuration work?
Related
VS2019 allows us to create stateless services on .net core 3. I was not able to find any sample codes on this. How can we enable inter-service communication (.net core 3 gateway communicating with stateless service)?
As far as I know, the reverse proxy or remoting is not implemented yet. What's the best approach for communication and load balance?
The implementation in .net core 3 shouldn't be any different than what you were using previously.
If you're using specific ports, you can just call http://localhost:<portNumber>.
If you want to dynamically resolve the service (which would imply that your port is system-assigned and not dev-assigned), an interesting read is here:
https://dzimchuk.net/implementing-a-rest-client-for-internal-communication-in-service-fabric/
You could construct the service fabric reverse proxy uri yourself too, if you know which service you want to call.
I have an ASP.NET Core backend service (no UI). I also have a UI website.
The website deploys and runs correctly on app service.
The backend service deploys but does not run, also on a app service.
I get greeted with an error: HTTP Error 500.30 - ANCM In-Process Start Failure.
The files are definitely there, although they are all under wwwroot. Is that correct even if it's just a backend service?
Just to understand the issue correctly, when you say, "The backend service deploys but does not run, also on a app service", does that mean it does not work both locally and also on App Service? If it doesn't work locally, it may not work on App Service. So, to isolate the issue ensure it works fine locally.
Typically, the error "500.30 In-Process Startup Failure", you may occur The worker process fails. The app doesn't start.The ASP.NET Core Module attempts to start the .NET Core CLR in-process, but it fails to start. The cause of a process startup failure can usually be determined from entries in the Application Event Log and the ASP.NET Core Module stdout log.
Also, ensure that App bitness (32 vs 64 bit) is correctly configured.
I have seen issues a common failure condition is when the app is misconfigured due to targeting a version of the ASP.NET Core shared framework that isn't present. Check which versions of the ASP.NET Core shared framework are installed on the target machine.
I'm working on an asp.net core 2.2 MVC web application. We are using signal r core version 1.1.0 (added via the nuget package Microsoft.AspNetCore.SignalR). The client side application is an angularjs application referencing version 1.1.4 of the aspnet-signalr javascript library.
Our application is deployed on Azure and the hosting app service is scaled horizontally : there currently two instances of our web application up and running. I'm testing the behavior of my application by using Google chrome version 75.0.3770.100 on a windows 10 machine.
The app service is configured so that the web sockets are enabled and the ARR affinity is disabled. I'm experiencing a strange behavior, basically if I test my application and I perform several browser hard refresh (ctrl + F5) it happens randomly that the client side application is unable to connect to the notification hub. The following errors are reported in the google chrome console:
WebSocket connection to 'wss://myapp.azurewebsites.net/notificationsHub?id=3Fmlw2yC5qm3vi0qny50Qg' failed: Error during WebSocket handshake: Unexpected response code: 404
Error: Failed to start the transport 'WebSockets': null
GET https://myapp.azurewebsites.net/notificationsHub?id=nEYPEDw5f0AkLz5otCAOyA 404
Error: Failed to start the transport 'ServerSentEvents': Error: Error occurred
GET https://myapp.azurewebsites.net/notificationsHub?id=2G9VVr5mcx7QT2wbSfwDLA&_=1561652513485 404
Error: Failed to start the transport 'LongPolling': Error
Error: Failed to start the connection: Error: Unable to initialize any of the available transports.
If I change the app service configuration so that both the web sockets and the ARR affinity are enabled everything works like a charm. My suspicious is that when the app service is horizontally scaled then the ARR affinity is required regardless of the transport protocol (in my case, both the server side application and the client browser are able to support the web socket protocol).
Based on my understanding, the official microsoft documentation states that when using web sockets as a communication protocol the client ARR affinity is not required, even if the hosting app service is horizontally scaled to multiple instances. At this point I'm not sure about my understanding of the signalr core documentation.
Am i missing something ? Did I misunderstood the official documentation ?
EDIT 3 JULY 2019
For the ones interested to this subject (scaling out a web application using signal-r core), you can refer to this github issue for all the details.
The short answer is that the new signal-r core is actually stateful and requires sticky sessions when the application is scaled out to multiple servers.
If you are on Azure only, you can avoid the usage of sticky sessions and have several other benefits by using the Azure signalr service.
If you don't want to use this azure service the only option to avoid sticky sessions is configuring signal r core so that the client-server protocol negotiation is avoided and the communication is done by using web sockets only (refer to the linked github issue for all the details). Notice that doing so you will lose the ability of downgrading to other protocols when web sockets aren't supported, which is one of the core features of signal-r core.
If you want to affinity disable, then I think the component you're missing is the hosted SignalR service. It's the proxy service that will maintain session info for you as your app service scales out. Follow these steps to add SignalR service as a service dependency to your project.
This question is with regard to ASP.NET Core 2.2 applications running on IIS, specifically when registering instances of IHostedService with the DI container.
Every article I read about IHostedService.StopAsync() just talks about StopAsync() being called when the host "shuts down", but I want to know what happens when IIS recycles.
My question(s):
1. Is StopAsync() called when the IIS recycles?
2. Is the answer the same regardless of using InProcess hosting or OutOfProcess hosting? (ASP.NET Core supports InProcess as of version 2.2)
Is StopAsync() called when the IIS recycles?
Yes
Reference Implement background tasks in microservices with IHostedService and the BackgroundService class
Deployment considerations and takeaways
It is important to note that the way you deploy your ASP.NET Core
WebHost or .NET Core Host might impact the final solution. For
instance, if you deploy your WebHost on IIS or a regular Azure App
Service, your host can be shut down because of app pool recycles.
.....
note: emphasis mine
which by extension would stop any IHostedService,
I have a .Net Core 2 app that needs to call a WCF service. I've been able to add connected service and it consumed the WSDL ok. My problem is, the call needs to be made via Azure Service Bus Relay.
I realise that the MS docs suggest .Neg Core clients use "Hybrid Connections" instead of WCF Relay but I have a BizTalk 2016 app listening at the other side of the WCF Relay, waiting to return data to the client. As far as I can tell, there is no capability for BizTalk to work with Hybrid Connections.
In .Net core it seems the only option for the WCF client is to configure via code (no app.config or equivalent). I can use the following:
svc.Endpoint.Binding = new System.ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.None);
However, there is no System.ServiceModel.BasicHttpRelayBinding? Has anyone managed to make calls to the Azure Service Bus Relay from .Net Core?
I found a solution for this problem and blogged about it here: BizTalk and the Hybrid Connection Manager