【发布时间】:2017-08-11 21:47:57
【问题描述】:
使用 c# winforms 应用启动 owin
创建了一个启动配置文件
[assembly: OwinStartup(typeof(Chatter.Host.Startup))]
namespace Chatter.Host
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
然后在我的窗体上:
private void StartServer()
{
try
{
SignalR = WebApp.Start(URL);
}
catch (TargetInvocationException)
{
//Todo
}
this.Invoke((Action) (() => richTextBox1.AppendText("Server running on " + URL)));
如何停止\重新启动 OWIN 服务,示例会很棒?
private void StopServer()
{
try
{
//STOP!!
}
catch (TargetInvocationException)
{
}
}
【问题讨论】: