我用以下启动类创建了一个新的类库项目:
public class Startup
{
public void Configure(IAppBuilder app)
{
app.Run(ctx =>
{
ctx.Response.StatusCode = 200;
ctx.Response.ContentType = "text/plain";
return ctx.Response.WriteAsync("Hello from Owin");
});
}
}
我安装了以下软件包:
<packages>
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.HttpListener" version="2.1.0" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="OwinHost" version="2.1.0" targetFramework="net45" />
</packages>
当我尝试从中运行owinhost.exe
时,/bin/debug
出现以下错误:
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.
我是否需要做任何其他事情才能让 OwinHost.exe 与类库项目一起工作(我在控制台应用程序中遇到了同样的问题)。