所以我創建一個服務localy,爲我的應用程序作爲WebJob有問題。這看起來像我閱讀所有的谷歌,但我找不到解決方案。 This one here不包括我,因爲它是關於驗證。Azure WebJob訪問被拒絕
因此,我有一個C#控制檯應用程序在我的電腦上有許多參考,ddls和大量計算,它們像服務一樣運行。主要功能,看起來像這樣:
static void Main(string[] args)
{
string baseAddress = "http://127.0.0.1:80";
Console.WriteLine(baseAddress);
if (args.Count() > 0 && !string.IsNullOrEmpty(args[0]))
baseAddress = args[0];
SelfHostServer server = new SelfHostServer(); //using Microsoft.Owin;
server.Start(baseAddress);
}
然後我有一個nodeJs應用程序發佈在Azure AppService上。基本上,我需要它調用C#服務並獲得結果響應。出於這個原因,我試圖用我的C#應用程序創建一個WebJob。我出版,並嘗試運行它,但我得到(這個錯誤是富勒姆蔚藍門戶控制檯):
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.HttpListenerException: Access is denied
at System.Net.HttpListener.SetupV2Config()
at System.Net.HttpListener.Start()
at Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 loggerFactory)
at Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, IDictionary`2 properties)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder builder)
at Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(StartContext context)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start[TStartup](StartOptions options)
at Avilda.Klevas.Core.Server.SelfHostServer.Start(String baseAddress)
at klevas.webapistart.Program.Main(String[] args)
它看起來像它與端口有問題,但我找不到任何合適的人anywere。我能夠運行其他exe文件,但不能與誰在監聽。我不在乎C#應用程序是不是可以從外部訪問,我只是想讓這兩個人進行交流。有任何想法嗎?或者也許其他解決方案(虛擬機除外)?
我設法在我的電腦上本地獲取此錯誤。然後通過以管理員身份運行Visual Studio來解決此問題。所以idk,也許有辦法以管理員身份運行WebJob? – Shpooke