To host the WebAPI through kestrel, when I run web.cmd as administrator through command prompt, it runs fine.
But when I run it as other user, I get the error as in the below screenshot:
UPDATE:
I for some reason had to restart the system. When I tried again it was working fine.
But then came the next issue.
I had hosted the webapi on IIS with name "WoApi" under "Default Web Site".
When I tried to access
http://localhost/woapi/api/Aspnet_Role
I got blank page.
Then I checked the stdout.log file. It had the below contents:
Hosting environment: Production
Now listening on: http://localhost:20822
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNet.Hosting.Internal.HostingEngine1
Request starting HTTP/1.1 GET http://localhost/woapi/api/Aspnet_Role
info: Microsoft.AspNet.Hosting.Internal.HostingEngine[2]
Request finished in 0.0187ms 404
So, then I tried with
http://localhost:20822/api/Aspnet_Role
and it worked.
But the port number keeps on changing every-time I restart the server.
How to keep a fix address?
Related
I have an application hosted on my local IIS (Windows 10).
From today I am not able to access the application in the browser (tried in Chrome, Browser and IE).
In the browser, I see 'ERR_CONNECTION_REFUSED'. (Same behaviour if I try to 'Browse Website' from IIS.)
I tried browsing the Default Web Site on localhost and was a success.
I am able to ping the application from the command prompt.
There are no logs related to it in the IIS logs and the event viewer.
In registry,
at path: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
it was having 2 values
removed the second one, left the default one.
This fixed my issue.
I used VS2017 to create an ASP.NET core API app, just a simple one.. I didn't even make any changes to it. it was able to compile just fine, able to debug in IIS Express just fine.. you know, the default /api/values which returns {value1, value2}.. just the default..
I tried to host it in IIS 10 on Windows 10. Added an application pool which has .NET CLR version set to "No managed code", keeping everything else as default. Using VS2017, published to folder, set IIS to point to that folder, set it to use port 8080. tried accessing it in browser with 127.0.0.1:8080/api/values and.. HTTP Error 500.19 - Internal Server Error. why? what did I not do?
In command prompt, typing dotnet --info shows the version as 2.1.200, and the .net framework as 2.0.7. In fact, I was even able to run the app directly from the command prompt by typing "dotnet .dll" and it would show listening on port 5000 and I was able to use browser to access 127.0.0.1:5000/api/values and the {values1, values2} would appear in the browser. But why is it that I can't use IIS to host it?
Talking about using command prompt to run the app using kestrel, I noticed a strange thing. setting the args in configure, I was able to use urls to dynamically change the port that kestrel is listening on, and I was able to enable remote access to kestrel using dotnet .dll --urls http://*:5050 for example, and it works fine.. BUT.. when I set the port to 6000 or greater, kestrel would say it's listening on that port, but remote client would not be able to access it. has anyone encountered this? using ports in the range of 5000~5999 works fine.. why?
Ensure the following:
.NET Core Hosting Bundle installed on the hosting server - https://www.microsoft.com/net/download/all
Application Pool .NET CLR version set to "No Managed Code"
Ensure that the Application Pool Identity user has read permissions on the published folder.
For details check: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.0
The service is running but I get a half corrupted page. I upgraded using the automatic update mechanism. Note that the teamcity is running behind an nginx server with the real service running at http://$hostname:8080/teamcity and nginx forwarding from http://$hostname/teamcity.
If I restart the service I get the following log in teamcity-server.log
https://gist.github.com/bradphelan/74ea8fa9c422c51a23820ee74cab72cc
linked as gist as SO will not allow pasting such a large file in.
Switch it off / switch it on. It works again. ( No idea why )
We have a Flex/Flash application that loads information from XML files created by a .NET application. It works fine under IIS but when I try to run it from Visual Studio 2010 or 2012 using the ASP.NET Development Server, the Flex/Flash app isn't loading the information. I brought up Fiddler and am able to see that there's an error occurring when the Flash tries to access the XML:
[Fiddler] The socket connection to localhost failed. ErrorCode: 10061. No connection could be made because the target machine actively refused it 127.0.0.1:80
I've turned off my Firewall but that didn't help. So, I'm not sure where the block is occurring. Any thoughts?
[Update: switched from Asp.NET Development Server to IIS Express and am still getting the exact same error.]
[Update2: I've verified that the XML file the Flash is trying to reach comes up fine in the browser: http://localhost:63318/ProductDetailsXML.aspx?ProductId=71]
It may have to do with it being served off of a specific port (not 80). How is your application requesting the XML file? According to your Fiddler log, it's trying port 80, but your site is running on port 63318.
I've installed Web Deploy 2.1 on a Server 2008 R2 running under VMWare.
In the IIS Manager (Management Service applet) I can see that "Enable Remote Connections" is checked and the port is set to 8172. Under "IIS Manager Permissions" I've added my Windows account (CORP\ekkis) and under the "Authentication" applet (for IIS) I have enabled "Windows Authentication".
I've also turned off the firewall.
So from the command line I test the system to work like this:
C:\Program Files\IIS\Microsoft Web Deploy V2>msdeploy -verb:dump -source:contentPath=\temp,wmsvc=192.168.0.70,username=CORP\ekkis,password=MyPass,authType=Basic -allowUntrusted=True
and get this:
Info: Using ID '9b954a0f-ff07-4e77-ba2c-d27472f5fda0' for connections to the rem
ote server.
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the destination computer ("192.168.0.70") using t
he Web Management Service, but could not authorize. Make sure that you are using
the correct user name and password, that the site you are connecting to exists,
and that the credentials represent a user who has permissions to access the sit
e.
Error: Object of type 'contentPath' and path '\temp' cannot be created.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
I've also tried deploying with Visual Studio 2010 from the host OS with the following service urls (I haven't found proper documentation on how to form this url):
https://192.168.0.70/
https://192.168.0.70:8172/
https://192.168.0.70:8172/MsDeployAgentService/
https://192.168.0.70/MsDeployAgentService/
I've tried the non-secure versions as well but just cannot get it to work. What is the correct format for the url? and what permissions am I missing?
the errors from VS have varied depending on how I attempt it but below is a sample:
Could not complete the request to remote agent URL 'http://192.168.0.70:8172//MSDEPLOYAGENTSERVICE'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Publish failed to deploy.
there really should be a guide out there to do this (yes, I've googled myself blue in the face)!
thanks - ekkis
ok, I've figured out that the correct url is:
https://192.168.0.70:8172/MsDeploy.axd
and that having the "Windows Authentication" enabled doesn't seem to make a difference. Also, having my account in the "Managers" list doesn't seem to make a difference either.
so the back end was all working fine (I've turned off the Web Deployment Agent Service). it was just the url I had wrong.