OWIN StartUp not working

In my statement, I stated the following:

[assembly: OwinStartup("MyClass", typeof(MyClass), "ConfigureOwin")] 

Launch class defined:

 public class MyClass { public void ConfigureOwin(IAppBuilder appBuilder) { } } 

And run owin as follows:

 WebApp.Start<MyClass>("baseUri"); 

However, it does not work. WebApp always tries to find a method called β€œConfiguration”, even if I specify to search for something else. What can I do?

+8
c # owin
source share
5 answers

For me, I needed to add Microsoft.Owin.Host.SystemWeb as a link. (Click Manage Nuget Packages and find it.)

Thanks to this blog post for a hint.

I ran into this problem because I switched from the Web API to the Web API with OWIN middleware for ADFS authentication .

+34
source share

If you use optimizeCompilations="true" in your web.config , you may need to set it to false and return to true .

+17
source share

Both OwinStartupAttribute and WebApp.Start<T>(StartOptions) are ways to specify which class to use to configure the OWIN pipeline, both assume that the specified type has a method with a Configuration(IAppBuilder) signature.

However, OwinStartupAttribute has overloads to indicate an optional method name. AFAIK there is no overload to indicate the name of the method when using the WebApp.Start<T> method.

OwinStartupAttribute most useful if you have an external component that runs the OWIN pipeline, for example. ASP.NET handler (using Microsoft.Owin.Host.SystemWeb ) or Helios (using Microsoft.Owin.Host.IIS ). If you use hosting (using Microsoft.Owin.Host.HttpListener ), it is best to use WebApp.Start methods.

Here's a great resource Discovering the OWIN Launch Class .

+7
source share

In your web.config appSettings file try adding this:

 <appSettings> <add key="owin:AutomaticAppStartup" value="true" /> </appSettings> 
0
source share

These are different reasons that startup.cs does not start. One common problem is this: startup.cs starts successfully, but the debugger does not start. If you have all the components installed, this may mean that the URL of the web project is assigned to work. external host, change it to IIS Express so that it discovers ...

go to the settings of the web project, web, then in the servers section select IIS express.

0
source share

All Articles