我想在连续的Azure Web作业中使用SignalR自托管项目。但是当我尝试运行它时,我收到以下错误:
[07/11/2014 10:58:44 > cbec50: SYS INFO] Status changed to Running
[07/11/2014 10:58:45 > cbec50: ERR ] Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. ---> System.Net.HttpListenerException: Access is denied
我认为控制台应用程序需要以提升的权限运行。有没有办法让这个工作?
先决条件:
Install-Package Microsoft.Azure.Jobs -pre
Install-Package Microsoft.AspNet.SignalR.SelfHost
完整来源:
using System;
using Microsoft.Azure.Jobs;
using Microsoft.Owin.Hosting;
using Owin;
namespace ConsoleApplication2
{
class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
class Program
{
static void Main(string[] args)
{
using (WebApp.Start<Startup>("http://localhost:8080/"))
{
Console.WriteLine("Server running at http://localhost:8080/");
var host = new JobHost();
host.RunAndBlock();
}
}
}
}
答案 0 :(得分:5)
得到response from David Ebbo(@ davidebbo):
"...you can only listen on a port through IIS.
WebJobs are more to do work and not run services."
我认为网络工作是一个很好的方式来主持一个信号器中心没有整个网站的足迹,但我需要找到一个替代方案。