Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Owin with EPiServer Alloy


I've installed the latest version of Alloy from the VS template.

Then I intalled the Microsoft.Owin.Host.SystemWeb package, and created the startup file for owin like this:

using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(EPiServerSite1.Startup1))]

namespace EPiServerSite1
    public class Startup1
        public void Configuration(IAppBuilder app)
            // For more information on how to configure your application, visit
            app.Run(context =>
                context.Response.ContentType = "text/plain";
                return context.Response.WriteAsync("Hello, world.");

I set a breakpoint at the line, just to see if it hits. The file isn't going to contain this code, I just wanted to see if the file was run.

But it doesn't work. Do I have to do any additional setup to get Owin working?

Aug 31, 2016 9:18


What do you mean with "it doesn't work"? I guess Episerver's routing is kicking in so if you want to try Owin out you need to do that on a mapped URL.

Aug 31, 2016 9:59

I mean that the startup file is never run. The breakpoint in there never trigger.

Can Owin only run on a specifc url?

Aug 31, 2016 10:03

I gues Owin is a module that runs ontop of everything, but you can map a URL to do something like this:

 app.Map("/util/logout.aspx", map => map.Run(ctx =>
     // Do you stuff

     return Task.FromResult(0);
Aug 31, 2016 10:14

The problem is that the configuration method is never executed as far as I can tell.

I have tried different configs, but so far no luck.

Aug 31, 2016 10:18

Perhaps some guidance?

Aug 31, 2016 11:27

I have the reference to Microsoft.Owin.Host.SystemWeb in the project. I don't think that's the issue, but thanks!

Aug 31, 2016 13:11

Now I'm trying this with no luck:

public void Configuration(IAppBuilder app)
     throw new Exception();
Aug 31, 2016 13:15

Think I fixed it by running it on IIS instead of just pressing F5 in VS.

Johan Björnfot set me on the right track with one of the answers on StackOverflow.

Aug 31, 2016 15:37

Should work on IIS Express though, we usually use Express in development and Owin works just fine.

Aug 31, 2016 15:38

Johan: Hmm, strange.

Also, I now uninstalled and reinstalled the owin packages again, and it stopped working again.

Edited, Aug 31, 2016 16:02

I got issues while ago when working with ServiceApi in IIS Express. Routes were not registered and Owin startup was not fired. Sometimes it worked, sometimes it didn't. Switched to IIS with no further issues. I found that clearing IIS Express cache and restarting the service - sometimes might help. Weird thing is this express :)

Aug 31, 2016 21:40
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.