-
Notifications
You must be signed in to change notification settings - Fork 307
Hosting with Microsoft.AspNet.Server.WebListener does not work in RC1 #503
Comments
Are you trying to run this behind the platform handler? That's not supported. Use kestrel. |
@davidfowl - do you mean IISPlatformHandler? As in app.UseIISPlatformHandler() in Startup.Configure()? The behaviour is the same with or without it. I want to self host the application on Windows (i.e. no IIS) and I need Windows Authentication so I think WebListener is my only option?? |
WebListener self-host should be fine, just don't use it with IIIS/Express (the default F5 in VS). |
That port may have been reserved for another app. See netsh.exe. You can try another port by adding "webListener": "Microsoft.AspNet.Server.WebListener --server.urls=http://localhost:5001/" |
@Tratcher Thanks for the response. At some point I had used netsh to allow listnening on port 5000 for the user I am using to run the asp.net application: netsh http add urlacl url=http://+:5000/ user= Until now I thought that was required to allow listening for http on a port. In fact it prevents you listening on a port with WebListener! Kestrel will work though. |
As far as I am concerned the issue can be closed, but I am not sure I am able to do it?? |
The issue is that the url you pass into netsh must match the one you give to weblistener. You do not need to preregister with netsh for localhost or running as admin. Kestrel is unaffected by netsh because it uses raw sockets, not http.sys. |
I thought the url did match, but maybe I was missing a / or "+" doesn't work in this instance. Anyway, I am working with localhost, which is all I need right now. Now I know what is required I'm sure I can work out what I need to do when I want to access my application from remote machines. Thanks for your help. |
|
Functional impact
If you use Microsoft.AspNet.Server.WebListener as your server when hosting an Asp.Net 5 application it fails during startup, terminating the process.
Minimal repro steps
Run Visual Studio 2015 Update 1 NOT as an administrator*
Create a new Asp.Net 5 project using the project template in Visual Studio 2015 Update 1
Add a dependency to Microsoft.AspNet.Server.WebListener in project.json.
"dependencies": {
....,
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
....
},
Add a new command for WebListener
"commands": {
...,
"webListener": "Microsoft.AspNet.Server.WebListener",
...
},
Start the webListener Command.
Expected result
A console app should start, hosting the web application using WebListener and listening on port 5000 (this worked OK in beta-8)
Actual result
The console app crashes with the following exception:
Microsoft.Net.Http.Server.WebListener: Information: Start
Microsoft.Net.Http.Server.WebListener: Information: Listening on prefix: http://localhost:5000/
Microsoft.Net.Http.Server.WebListener: Error: Start
Microsoft.Net.Http.Server.WebListenerException (0x80004005): Access is denied
at Microsoft.Net.Http.Server.UrlPrefixCollection.RegisterPrefix(String uriPrefix, Int32 contextId)
at Microsoft.Net.Http.Server.UrlPrefixCollection.RegisterAllPrefixes()
at Microsoft.Net.Http.Server.WebListener.Start()
Further Information
Firewall is configured correctly to allow listening on port 5000. This can be tested by using Microsoft.AspNet.Server.Kestrel instead, which works fine.
The host machine is running Windows 7 Professional Service Pack 1
*WebListener will start if run as an administrator but you get "HTTP Error 503. The service is unavailable" if you try and access the application.
The text was updated successfully, but these errors were encountered: