Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OWIN WebApp.Start gives A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

Tags:

.net

owin

In my code i have this:

        HOST = "*";
        PORT = 9000;
        baseAddress = "http://" + HOST + ":" + PORT + "/";

        // Start OWIN host. Should be called in TT extension code
        WebApp.Start<Startup>(url: baseAddress);

which is leading to:

A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll Additional information: Exception has been thrown by the target of an invocation.

Online I have found a possible solution by typing in CMD run as Admin:

netsh http add urlacl url=http://+:9000/ user=Everyone

but this has not resolved the issue. Can anyone help?

like image 541
azuric Avatar asked Jan 08 '15 14:01

azuric


1 Answers

You simply run in an elevated cmd:

netsh http add urlacl url=http://*:9000/ user=your_user_name

Please note, that you mentioned using a star and not the plus sign. So you have to add a star route to your urlacl and not a plus route as mentioned in your post. After this, you don't have to start it as Admin.

like image 167
Manuel Rauber Avatar answered Sep 18 '22 14:09

Manuel Rauber