Run self-hosted OWIN application in Azure Web Apps -
it possible run suave.io app on azure web apps because of iis8 feature called httpplatformhandler. tried run self-hosted owin application same way, got exception on startup:
unhandled exception: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.net.httplistenerexception: access denied @ system.net.httplistener.setupv2config() @ system.net.httplistener.start() @ microsoft.owin.host.httplistener.owinhttplistener.start(httplistener listener, func`2 appfunc, ilist`1 addresses, idictionary`2 capabilities, func`2 loggerfactory) @ microsoft.owin.host.httplistener.owinserverfactory.create(func`2 app, idictionary`2 properties) --- end of inner exception stack trace --- @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolean constructor) @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments) @ system.reflection.runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ microsoft.owin.hosting.serverfactory.serverfactoryadapter.create(iappbuilder builder) @ microsoft.owin.hosting.engine.hostingengine.startserver(startcontext context) @ microsoft.owin.hosting.engine.hostingengine.start(startcontext context) @ microsoft.owin.hosting.starter.directhostingstarter.start(startoptions options) @ microsoft.owin.hosting.starter.hostingstarter.start(startoptions options) @ microsoft.owin.hosting.webapp.startimplementation(iserviceprovider services, startoptions options) @ microsoft.owin.hosting.webapp.start(startoptions options) @ microsoft.owin.hosting.webapp.start[tstartup](startoptions options) @ microsoft.owin.hosting.webapp.start[tstartup](string url) @ webappsample.program.main(string[] args) in c:\users\egger\workspace\webappsample\webappsample\program.cs:line 14
it seems not allowed open port. web.config looks this:
<?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="site.log" startuptimelimit="20" processpath="%home%\site\wwwroot\webappsample.exe" arguments="%http_platform_port%"> </httpplatform> </system.webserver> </configuration>
i use http_platform_port
listen on right port. web app starts server follows:
class program { static void main(string[] args) { var port = int.parse(args[0]); var url = string.format("http://127.0.0.1:{0}", port); console.writeline("starting web app @ {0}", url); using (webapp.start<startup>(url)) { console.readline(); } } } public class startup { public void configuration(iappbuilder app) { app.useerrorpage(); app.usewelcomepage("/"); } }
the url seems ok because output this: starting web app @ http://127.0.0.1:32880
.
the web.config , binaries in root directory , published app using local git repo.
why can't open port using owin? what's different suave.io sample?
edit: saw there request support exact scenario: https://feedback.azure.com/forums/169385-web-apps-formerly-websites/suggestions/4606121-support-owin-self-hosting-in-azure-websites
i had same problem. solved running visual studio admin.
(you may need restart azure emulator well)
Comments
Post a Comment