I am trying to implement login to my own OWIN hosting solution.
My MiddleWareclass is as follows:
public class HostingMiddleware : OwinMiddleware
{
private readonly ILogger _logger;
public HostingMiddleware(OwinMiddleware next, IAppBuilder builder)
: base(next)
{
_logger = builder.CreateLogger<HostingMiddleware>();
}
public override Task Invoke(IOwinContext context)
{
_logger.WriteVerbose(string.Format("{0} {1}: {2}"));
context.Response.Headers.Add("Content-Type", new[]
{
"text/plain"
});
return Invoke(context);
}
}
Then I use this in my class Startup.
public class Startup
{
public void Configuration(IAppBuilder builder)
{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
builder.UseWebApi(config);
builder.Use<HostingMiddleware>(builder);
}
}
When I delete builder.Use<HostingMiddleware>(builder);, I can make an HTTP request and get a response, however, when I implement my class MiddleWare, I get:
No WebSocket support detected, Windows 8 or later is required.
Going forward, the magazine does not work as it should. Of course, there is a way to make the log work in Windows 7, otherwise the functionality will be useless? Any ideas on what I need to do?
Thanks in advance.
source
share