Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difficulty running OwinHost from the command line

Tags:

host

owin

I have been working through various OWIN tutorials and have consistently encountered the same problem; the applications work fine when I launch them from within Visual Studio (2013) using F5, but when I navigate via the command line to Owinhost.exe and launch it, I get the same error every time:

Error: System.EntryPointNotFoundException

The following errors occurred while attempting to load the app.

  • No assembly found containing an OwinStartupAttribute.

  • No assembly found containing a Startup or [AssemblyName].Startup class.

Of the various suggestions online, I have:

1) Made sure that the output directory is just "/bin" and not "/bin/debug".

2) Defined the assembly in my startup class:

[assembly: OwinStartup(typeof(StartUpDemo.Startup))]

3) Set my web.config

<appSettings>
<add key="owin:AppStartup" value="StartUpDemo.Startup"/>
</appSettings>

4) I have also tried disabling OWIN startup discovery using appSetting owin:AutomaticAppStartup with a value of "false" all to no avail.

It seems like OwinHost.exe is not even finding my application .dll, but as I mentioned before, it works fine in VS2013 when I launch it from within the IDE. I have changed the project settings in the "web" tab to use OwinHost, but otherwise the project setup is normal. Does VS2013 have information that I need to pass into the command line to get it to work correctly? Am I missing something in my configuration?

like image 946
user2187811 Avatar asked Oct 20 '22 21:10

user2187811


1 Answers

Well, I don't know if this question has already been answered but anyway I had the same issue when trying to run through Owinhost.

The problem was that I was trying to run Owinhost in the ..\tools\ path. Actually what have to be done is be in the project path (Eg. Project.Web) and being at this path run the Owinhost calling: "..\packages\OwinHost.\tools\OwinHost.exe"

Conclusion:

Wrong:

C:\{your_root_path}\{your_solution}\packages\OwinHost.<version>\tools> OwinHost.exe

Correct:

C:\{your_root_path}\{your_solution}\{your_project}> ..\packages\OwinHost.<version>\tools\OwinHost.exe

Hope I have helped. Regards.

like image 64
dime2lo Avatar answered Jan 02 '23 21:01

dime2lo