I am migrating my current code which is in .NET framework 4.8 to new .NET Core 5.0. Following is my original Startup.cs.
public class Startup
{
public void Configuration(IAppBuilder app)
{
var container = new UnityContainer();
var unityConfiguration = new UnityConfiguration();
unityConfiguration.RegisterTypes(container);
GlobalHost.DependencyResolver = new UnityDependencyResolver(container);
GlobalHost.HubPipeline.AddModule(new SessionIdCheckModule());
app.UseCors(new CorsOptions
{
PolicyProvider = new WildcardCorsPolicyProvider()
});
var listener = (HttpListener)app.Properties[typeof(HttpListener).FullName];
listener.AuthenticationSchemes = AuthenticationSchemes.Ntlm | AuthenticationSchemes.Negotiate;
//Throttling of http.sys to prevent too many requests being accepted at once.
var maxAccepts = 25;
var maxRequests = 25;
var queueLimit = 25;
var owinListener = (OwinHttpListener)app.Properties[typeof(OwinHttpListener).FullName];
owinListener.SetRequestProcessingLimits(maxAccepts, maxRequests);
owinListener.SetRequestQueueLimit(queueLimit);
TurnOffWebSocket(GlobalHost.DependencyResolver);
app.MapSignalR();
}
//Have to use Ajax long polling as the transport, to get around mixed content blocking in browsers.
public void TurnOffWebSocket(IDependencyResolver resolver)
{
var transportManager = resolver.Resolve<ITransportManager>() as TransportManager;
transportManager.Remove("webSockets");
transportManager.Remove("serverSentEvents");
transportManager.Remove("foreverFrame");
}
}}
Can anyone suggest on following.
- What is the replacement of Globalhost.Dependency resolver?
- I want to keep using Unity for DI and not in build DI of asp.net core. How can I achieve that ?
- What can be used to achieve behaviour of HubPipelineModule?