This project has moved and is read-only. For the latest updates, please go here.

getting "Sequence contains no matching element" error when running katana.exe

May 3, 2013 at 8:54 PM
Edited May 3, 2013 at 8:59 PM

I have a Web API application which I manged to host through the katana bits on my own exe (the code is here:

I also created a seperate application to host the the application through the katana.exe but I am unable to run it. I ran the exe with the following command under my application path and the bin directory exists with the assemblies inside it.
The error I'm getting is the below one:
Error: System.InvalidOperationException
Sequence contains no matching element
The code is available here:

What would be the problem?
May 3, 2013 at 11:36 PM
Can you post the whole stack trace?
May 4, 2013 at 8:09 AM
Edited May 4, 2013 at 8:11 AM
Hi Tratcher,

Thanks for the answer. I'm unable to view the stack trace (maybe I don't know how). I tried the verbose switch but it didn't get me the detailed error message, too:


You can clone my project, switch to katana-host and get it working if you need to have a better view:

Here is the complete view of my Startup class:
using Owin;
using PingYourPackage.API.Config;
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Web.Http;

namespace PingYourPackage.API.OwinHost {

    public partial class Startup {

        public void Configuration(IAppBuilder app) {

            HttpConfiguration config = new HttpConfiguration();

            var efMigrationSettings = new PingYourPackage.Domain.Migrations.Configuration();
            var efMigrator = new DbMigrator(efMigrationSettings);


        private void RegisterAddresses(IAppBuilder app) {

            Uri HostUri = new Uri("http://localhost:16897/");
            Uri HostUriHttps = new Uri("https://localhost:44368/");

            // NOTE: OwinServerFactoryAttribute.Create method and 
            //       OwinHttpListener.Start should give you a hint on how
            //       to register the addresses.
            app.Properties["host.Addresses"] = new List<IDictionary<string, object>> {
                new Dictionary<string, object> { 
                    { "scheme", HostUri.Scheme },
                    { "host", HostUri.Host },
                    { "port", HostUri.Port.ToString()  }

                new Dictionary<string, object> { 
                    { "scheme", HostUriHttps.Scheme },
                    { "host", HostUriHttps.Host },
                    { "port", HostUriHttps.Port.ToString()  }
May 4, 2013 at 1:59 PM
OK, I simplified the failing sample. Here it is:

Just run the Run.cmd there. You should see the "Sequence contains no matching element" error.

This is a class library project + it outputs the assemblies directly under the bin directory; not under bin\Debug or bin\Release.
May 4, 2013 at 4:46 PM
Ah, it looks like you're trying to mix package versions. You have v0.22 of Katana.exe but v1.1 of Microsoft.Owin.Host.HttpListener. There have been some updates in the loading contract between the two, so you need to use the same versions together. FYI: Katana.exe has been renamed to OwinHost.exe, which is probably why you're using an old version. It looks like it works with the new version.