How to switch your project's port? - iis

I got this error out of nowhere. I tried everything here - How to solve “Microsoft Visual Studio (VS)” error “Unable to connect to the configured development Web server”
and nothing works. I'm using VS 2017.
error message:
Microsoft's suggestion:
EDIT: tried changing the port in the "applicationhost.config" file - didn't work, just made another "WebSite". so in solution manager - instead of WebSite1 (1), it became WebSite (2), dammit! :(
why can't I change ports without it making a new website and sticking to the same one?

To change the port for the project, we need to change the IIS express settings for the current project.
Above the VS2017, the configuration file of IIS Express located in the below directory.
SolutionName/.vs/SolutionName/config/applicationhost.config
Go to the actual section for the project, such as,
<site name="WebApplication1" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\Administrator\source\repos\VsGit-\Test\WebApplication1" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56697:" />
<binding protocol="https" bindingInformation="*:44323:" />
</bindings>
56697 and 44323 port are the specific port for the website, change it and save the file, then we restart IIS express/Visual Studio, that’s all.
Note: Restart action is necessary for applying the latest configuration in IIS Express.
Feel free to let me know if the problem still exists.

Related

python flask test site not working on IIS server, however it works on localhost

I have been given access to an IIS server
Windows 2012 R2
IIS version 8.5.9600
I successfully installed
python 3.8
wfastcgi
flask
i wrote a basic "hello world" python flask app which i tested and works on the localhost machine
I created my web.config file and has the following
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Python36\python.exe|C:\Python38\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="hello.app" />
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\test_site" />
</appSettings>
</configuration>
For this site i enabled IISUsers to have Modify and Write access
I am unable to load the site though. Am i missing anything in the configuration?
When i click on IIS, FasCTI Settings appears and properly points to the python.
I am getting a 500 error in the logs.
help is alwasy appreciated.
Best
DamnGroundHog
So it looks like i have everything correct but i decided to play around with some settings, specifically bindings.
when i changed the port from 80 to 8080 and took the host name away, it worked. Yay! Now i will look at bindings and see why my basic index.html worked but the hello.py didn't
Through my restoration of a project similar to your python project, it can be successfully run on the window server. I follow this tutorial, you can refer to it.
Detail steps
In the process of my application, it only works when the port is also 8080 because the application is deployed under the default website. At the same time index.html works because the default document is set, you can check your default document module.

How do I configure a .net core API to work in IIS?

I've got a .net core API created in Visual Studio 2017 that's working fine. When I go to deploy it I get error message HTTP Error 500.19 with error code 0x8007000d. I've found multiple solutions online such as making sure windows features are installed, removing the .net CLR version, changing the application pool identity, changes to web.config and applicationHost.config, but nothing has worked. Is there a way to definitively find what the problem is or am I stuck doing trial and error with the myriad of possible solutions? Any specific solutions you know of?
Here are screenshots of the IIS settings and my Windows features:
Here's my web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*"
modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\DishbooksAPI.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Here's the IIS error:
Some stackoverflow pages I've tried (this is not an exhaustive list):
HTTP Error 500.19 when publish .net core project into iis
HTTP Error 500.19 with Error Code 0x8007000d visual studio 2017 while deploying .net core application
ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d
HTTP Error 500.19 - Internal Server Error web config .net core web api
asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19
First of all, you need to install ASP.NET Core Module in web server.
Here is the download link.
Then install either SDK or Runtime in web server.
Trouble Shooting
If it still doesn't work, open a command prompt. Navigate to the web application folder and type dotnet YOUR_APP.dll. You should see something like this -
C:\APIs> dotnet YOUR_APP.dll
Hosting environment: Production
Content root path: C:\APIs
Now listening on: http://localhost:5000
Application started: Press Ctrl+C to shut down.
It means your application can run in the web server without IIS. Then you need to trouble shoot in IIS or some other things.
You would need the hosting bundle to be installed on IIS
https://dotnet.microsoft.com/download/dotnet-core
Steps :
click the preferred version
Search for 'Hosting Bundle' word (should be on the right side)
Install the same
re-start IIS. And validate your site and see the magic
Why Hosting bundle is needed? Check following article
https://dotnetcoretutorials.com/2019/12/23/hosting-an-asp-net-core-web-application-in-iis/
How to check if hosting is installed?
How to determine if asp.net core has been installed on a windows server

Core 2.0 Publish IIS HTTP Error 500.19 - Internal Server Error

I have read a lot of post with the same error I have. The problem I have is that I have it running on the same machine I developed the solution.
I have Windows 8.1 and IIS 7.5. Express I am running several MVC Framework XXX solutions on me IIS and I do not have problems. The problems appears when I publish a solution Core 2.0...
I have created a basic Web Core 2.0 MVC solution. Just the same project it is created by Default. (Created an Core 2.0 MVC and Publish it).
I have Visual Studio 2017, so I have installed SDK installed.
I have created a site in IIS (inetpub/wwwroot) for it, drop in the published code, and configure the App Pool to run "No Managed Code". I set port to 5010.
When I run the Project from cmd: dotnet core20.dll it says it is running listening on port 5000, instead on port 5010.
So, i set port 5000, but when i run it from cmd it shows an error.
Microsft.AspNetCore.Server.Kestrel[0] Unable to bind to localhost:5000 on the IPv4 loopback interface: Error 4092 EACCES permission denied. Unabled to start Kestrel.
Why it runs on port 5000 if I set on port 5010?
When I run it from Browser i have this error
My web.Config is the basic web.config created ruting the publishing..
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\core20.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 21dc60b6-a958-447d-8ed3-25a6195a06ea-->
On Windows Features turn on or off--> IIS Services--> Application Development Features, all options are selected
The error I have
I have the same problem with Core 2.0 Angular Application... So I miss to install something.
I have not installed the .NET Core Windows Server Hosting bundle. I do not know it is necessary.
I do not know if i have to install Kestrel, or how to install it.
I asume all this has to be installed when I installed Visual Studio 2017.
Any ideas what I am missing?
thanks
I have not installed the .NET Core Windows Server Hosting bundle. I do not know it is necessary.
There's your problem. Install the hosting bundle. Without it, IIS has no idea how to handle an ASP.NET Core app. In particular, your error here is because the <aspNetCore> tag doesn't exist for usage by Web.config, without that bundle either. So, while the error is a bit obtuse, it is technically telling you what the issue is.
Additionally, after installing the bundle, you must either restart your server or completely stop and restart the IIS service (not iisreset):
> net stop was /y
> net start w3svc
It's better to restart the server entirely, if you can, just to make sure everything is fresh, but starting and stopping web services should be enough to load in the ASP.NET Core module.
All of this is covered in the documentation.

HTTP Error 403.14 - Forbidden asp.net 5 & MVC 6 iis10

I know this question has been asked and answered a few time but those questions are slightly different and the answers to those questions do not resolve my issue.
I have a asp.net 5 & MVC 6 application that works fine in IIS Express and self hosted in WEB. However when I publish to a folder and point IIS at the wwwroot folder I get the HTTP Error 403.14 - Forbidden error.
I have tried IISReset and I do have a default root.
Requirements
Windows 7 or better
Windows Server 2008 R2 or better
Have IIS installed
Procedure
First, make sure you have the HTTP Platform Handler installed in your IIS (x86 / x64).
Publish your application to the file system and take the content of the \artifacts\bin\MyWebApp\Release\Publish folder and copy it into your IIS Server.
When configuring your application, target the wwwroot folder that you copied over.
Now you'll need to unlock the system.webServer/handlers section which can be found in IIS Manager on the server node under Configuration Editor. Search for the right section and unlock it from the right action pane.
Make sure that the App Pool is set to No Managed Code. DNX is being run as an external process. IIS doesn't need to know about what it's currently running.
Finally, create a web.config with the following content:
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
</system.webServer>
</configuration>
It should be running at that point.
Source

How to run Node.JS server for a web application?

Info: I am very new to node.JS!
I have written a sample server that can listen to http requests on port XXXX. When I run this server from commandline (Windows) it seems to work well. It responds to the requests made to localhost:XXXX when opened in a browser.
Question: Is this how this is supposed to work? For the node server to run, should there always be a CMD prompt open for the server to listen to requests?
Can I not do "something" with IISNode?
I understand that if I make a request to a JS files, which is noted in IISNode as a Node.JS file and that NODE should be handling it; then I will have Node handling the request for me.
But then this assumes that IIS is the web server for me and that specific requests can be handled by Node.
I hope I am making sense here! :)
On Windows you have two options of hosting node.js applications:
Self-host the node.exe process just like you would on *nix. During development you will probably just start it from the command line. In production you want to come up with a mechanism that will provide process lifetime management around node.exe (e.g. start it when the OS starts). The most reasonable way of doing it on Windows is to use Windows Services (also known as NT Services). A component that can help you do this is http://nssm.cc/.
Host node.js with the IIS using iisnode (http://github.com/tjanczuk/iisnode). Compared to self-hosting this method has a number of benefits outlined in https://github.com/tjanczuk/iisnode/wiki. But you also want to explore the performance implications (not all of them bad actually): http://tomasz.janczuk.org/2012/06/performance-of-hosting-nodejs.html.
I solved it using a proper method. Yes, IISNode it is.. But none of comments seemed to answer how to "run" app.js for different applications hosted on same IIS (which is also serving PHP, ASPX, etc)
Step 1.
Edit your node application’s entry-point (typically) app.js for the new URL structure.
An express app assumes that it owns the entire URL space and starts the URLs from the root itself, as shown:
Edit you app.js to look like the following (but put YOUR app’s directory name instead of “aaspass”!!):
Now put a web.config file at the root of your app which looks like the following (You may use this template: webconfig).
Again edit the file and change the name “aaspass” to your app’s directory name.
Thats it! You may do this for as many apps as required and host them on SAME server.
What worked for me:
Install IISNode
Install URL Rewrite module of IIS
Add web.config file in your Node.js app/folder. Here are the content of web.config file:
In the handler, I just need to point to app.js (typical entry point of your application). I have not made changed to any of my routes (there is no need to append any text).
..
<configuration>
<appSettings>
<add key="NODE_ENV" value="production" />
</appSettings>
<system.webServer>
<handlers>
<add name="iisnode" path="server/app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<clear />
<rule name="cdw">
<match url="/*" />
<action type="Rewrite" url="server/app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
If you are on Windows you can (and probably should) run Node.js under IIS:
http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx

Resources