No1*_*ver 7 c# windows-services signalr
我在C#(vs2013)上写了一个小型POC应用程序(控制台应用程序),它使得:主机和客户端.
主机端的代码:
string url = "http://*:8900/";
using (WebApp.Start(url))
{
Console.WriteLine("Server running at " + url);
lock (just4lock)
Monitor.Wait(just4lock);
}
Run Code Online (Sandbox Code Playgroud)
只有当我使用"以管理员身份运行"运行我的(控制台)应用程序时,它才有效.
好的,现在我想将此代码移到我的Windows服务应用程序中.当我在Windows服务上运行相同的主机代码时,我收到此错误:
An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.Owin.Hosting.dll
Additional information: The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener
Run Code Online (Sandbox Code Playgroud)
我的服务以"本地系统帐户"运行.我没有看到任何让它"以管理员身份运行"的选项.
您是否知道如何在没有管理员的情况下使SignalR自托管工作?
我怎么能让这个Windows服务以管理员身份运行?
谢谢!
pen*_*eri 13
您是否尝试过使用已注册的Startup对象?
WebApp.Start<Startup>(url);
Run Code Online (Sandbox Code Playgroud)
然后...
class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
Run Code Online (Sandbox Code Playgroud)
这对我们来说效果很好......
| 归档时间: |
|
| 查看次数: |
7686 次 |
| 最近记录: |