Azure WebApps中自托管的OWIN SignalR

时间:2015-11-30 16:58:56

标签: asp.net azure f# signalr owin

我正在使用HttpPlatformHandler技巧部署相当多的F#应用程序和服务,但我正在尝试使用OWIN和F#启动并运行信号服务器,并且没有任何东西“正常工作”。

我有一个非常简单的OWIN和Signalr服务器在本地工作得很好但是当我尝试将它推到azure时似乎没有任何工作(好吧一切都悬挂)。

[<EntryPoint>]
let main argv =     

    // Code omitted for brevity (works in suave.io)
    let localPort = getEnvironmentVariableOrDefault "my-port" "8085"

    let startup (a:IAppBuilder) =            
        a.UseCors(CorsOptions.AllowAll) |> ignore
        a.MapSignalR() |> ignore

    let hostUrl = sprintf "http://localhost:%s" localPort
    use app = WebApp.Start(hostUrl, startup)

    Console.WriteLine("Server running on "+ hostUrl)
    Console.ReadLine() |> ignore

web.config非常简单

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <handlers>
        <remove name="httpplatformhandler" />
        <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform stdoutLogEnabled="true" stdoutLogFile="my.log" startupTimeLimit="20" processPath="%HOME%\site\wwwroot\MyOwnSelfHost.exe">
        <environmentVariables>
          <environmentVariable name="my-port" value="%HTTP_PLATFORM_PORT%"/> 
        </environmentVariables>            
    </httpPlatform>
</system.webServer>
</configuration>

我在这里做错了,使用HttpPlatformHandler有不同的方法吗?

希望得到一些帮助,让这个运行!如果唯一的选择是切换到启用IIS的Web项目,那么这是唯一的选择,但是想肯定地知道。

编辑:例外日志

Application: MyOwinSelfHost.exe Framework Version: v4.0.30319 
Description: The process was terminated due to an unhandled exception. 
Exception Info: System.Reflection.TargetInvocationException 
Stack: 
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) 
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) 
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) 
at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(Owin.IAppBuilder) 
at Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(Microsoft.Owin.Hosting.Engine.StartContext) 
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(Microsoft.Owin.Hosting.Engine.StartContext) 
at Microsoft.Owin.Hosting.WebApp.StartImplementation(System.IServiceProvider, Microsoft.Owin.Hosting.StartOptions, System.Action`1) 
at MyOwinSelfHost.Starter.main(System.String[])

HttpPlatformHandler错误

Process '4200' failed to start. Port = 5332, Error Code = '-2147023829'.

0 个答案:

没有答案