This question already has answers here:
What is Kestrel (vs IIS / Express)
(4 answers)
Closed 1 year ago.
Actually I understand that IIS Express is lightweight development server. From the other side "dotnet run" runs the application as a console application and binds it to random port.
But what is the actual difference? I can launch big enterprise application by IIS Express and by "dotnet run" and both cases work perfectly.
Till now all the difference I see is that IIS Express adds icon to the taskbar and dotnet run allows to see console output. But those are minor differences. It should be some global ones why IIS Express is so widespread nowadays.
Some structurization can be found here: ASP.NET Core launch settings: IIS Express, IIS, Project, Executable. But it still doesn't explain the difference.
dotnet run will use the embedded Kestrel server. IIS Express will use IIS Express as a reverse proxy which calls Kestrel behind the scenes. In either case a server is hosting your app.
You can toggle your local server choice by adjusting the run configuration. IIS Express will use...IIS Express. But if you instead select the project (in the case of the screenshot, it's titled weatherapi) it will use Kestrel instead. You'll see a command prompt pop up, showing some basic configuration data (assuming you haven't changed the default logging output). The first time it's run, you may have to accept/install the localhost TLS certificate, so that you don't run into TLS errors.
One way of confirming which process you are using, is to call get-process in powershell, along with either iisexpress or {nameOfProject}
More info from the docs
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/?view=aspnetcore-3.1&tabs=windows
Related
I have this setup to change the URL to 5002.
After running, this the result.
From our friends at MS support:
"IISExpress uses http.sys for its communication and it requires SSL ports to be registered as Administrator. To avoid running Visual Studio as administrator, IIS Express reserves the port range 44300 - 44399 when it is installed. As long as you select a port within this range (which is what VS does) you do not need to run IISExpressAdminCmd to register the URL."
via support link: https://developercommunity.visualstudio.com/content/problem/39430/changing-port-number-in-a-web-project-does-not-imm.html
Solution #1 Use IIsExpressAdminCmd.exe to register the URL
From cmd prompt go to directory
C:\Program Files (x86)\IIS Express
Run IISExpressAdmiCmd to register the url
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:5002/ -UseSelfSigned
Solution #2
Run VS under admin context
Solution #3
Switch the port to a pre-registered one 44300 - 44399
A few things to try;
Search through your project code (using find all) looking for
instances of "5002" or whatever your port number was previously. You
will be looking for references in generated code rather than code you
have created yourself.
Try with a difference browser (Chrome / Firefox etc).
Shut down any other running applications.
Try running without https. If this works you can focus your effort on getting the developer certificates working.
Stop and start visual studio (its annoying how often this solves anomalies!)
Check that the IIS express instance is running in the tray - click on the tray, locate the respective running application and
click browse.
Create a completely clean application using port 5002 and compare the two solutions to relevant differences.
Reboot and try again - in case there are any other applications locking this port number.
I have an asp.net application. It has 7 .Web projects, each running on a different port.
I am able to access the APIs and web page for each .Web project except for one: DemandService.Web.
For this particular .Web project, I cannot receive any valid response. The response code is always HTTP 426 Upgrade Required, and this response is sent with the following Headers: server →WebSocket++/0.3.0-alpha4.
Further, this .Web project no longer appears in IIS Express list of running sites.
I have re-GETed my application and have restarted my computer. I verified that there are no pending changes in DemandService.Web that are not found in other .Web project. I am unsure what has changed that may cause this.
Any ideas? Can I reset my IIS Express configuration somehow?
EDIT
I uninstalled and reinstalled IIS Express 10.0. Now IIS Express indeed starts my .Web project and I can see it running. However, instead of using the port 9005 specified in the project properties, it runs the project on 44322 and is otherwise working.
Why is IIS Express switching the port on me? Seems like there is some conflict with port 9005 configuration. Is there a vhost directory I should re-configure?
Sure enough, the fact that the protocol being used on port 9005 was WebSockets was an indication that the response wasn't coming from IIS Express and therefore I could assume that it wasn't a project or IIS Express configuration problem.
Running netstat -a -b shows all the applications using a port on my computer. I examined which process was using port 9005 and the application was CiscoVideoGuardMonitor.exe.
This software is StreamingDRM software that comes with DirectTV player. I installed this last week to watch a basketball game.
Uninstalling this software gave me my port back, which allowed IISExpress to start my service properly, and now I am able to access my .Web project.
I am a telecom engineer, I have studied a little bit of coding but I am not a professional, I have to develop a c# asp.net app for my company and I have some issues with debugging my app with Visual Studio 2015. I hosted my app on IIS (not IIS Express, even if I don't understand the difference), when I hit debug (with Firefox, Google Chrome...) a message of error displays where it is written:
unable to start debugging on the web server the remote server returned an error 400
I have litterally tried everything, can you please help me and give me solutions that I will understand (I am no professional), if you need a screen shot or something please let me know.
Clarifications/details (based on comments, etc.), and since "just use localhost/foo" sounds too magical:
if you're debugging on a remote web server (not your own PC), you'll have to setup the remote machine to allow such. This may or may not be feasible (not your server, etc. etc.).
Hence Visual Studio provides local debugging (Express or local IIS)
What is IIS Express?
When I want to start a project I can eather store it on IIS or IIS Express
Sure, but you'll have to know how to set things up (see links)
When I use IIS, and click on debug, I have error 400 and the browser doesnt open But When I use IIS Express and click on debug, it debugs, the browser opens and I have a 500.52 error
Set debug=true. It should give you error/exception detail(s) (also in link above)
So I am storing my project on IIS (inetpub\wwwroot...) and when I design and write my code I just press start without debug and the browser opens with my app appearing
Same as above, that just means IIS is running your app just like any other ASP.Net app. It does not automatically mean you can attach to it and debug.
While you can certainly develop that way (using /wwwroot), you'll be better off deving in your own directory, using VS/IIS Express, and publish to IIS (as simple as file system copy). You'll also learn what publish means (compiling), what in all your code is "published"/needed in live/production. If you kept deving in IIS the way you are, you'll likely not know the difference.
IIS admin is a bigger topic (multiple apps, multiple sites, and associated configuration).
I have successfully setup my development environment on one machine utilizing IIS Express and Windows Authentication to essentially force a web application to use SSL. When I pulled the code down onto a secondary dev machine, I've run into all kinds of issues.
It appears that the startup URL as defined in the project properties while working on the initial dev machine needed to be resetup on the new machine. I went into the IIS Express config and made sure that anonymous authentication was disabled and Windows Auth was enabled. I also added the bindings to essentially replicate what the initial dev machine was setup as.
I then opened the web app in Visual Studio again and this time received no errors or warnings. I figured no errors meant things would be OK.... Whoops...
The app now appears to load and I'm immediately challenged for my windows credentials. I enter them, and then get re-challenged. It appears there is some kind of loop going on here.
1. What am I doing wrong?
2. Shouldn't there be a better way for distributed development and IIS Express (SSL)?
I have a C# web service that I am trying to debug in Visual Studio 2008, and when I try to run it, Internet Explorer pops-up as expected, but it just displays 'waiting for response from localhost...' in the status bar. I have left it running for a few minutes and it never responds.
I have other web services that I am able to debug fine, is VS2005 and 2008. The problem web service is impersonating a different identity in the web.config file, but I have no problems with this same user on a different web service (in VS2005).
Does anybody have any ideas on what might be preventing it from starting up? Interestingly, a colleague has the same problem with a web service that IS working on my machine, even though we are working with identical code. Something must be configured differently...
By the way, I've noticed that the 'Temporary ASP.NET Files' folder is missing from both
C:\Windows\Microsoft.NET\Framework and C:\Windows\Microsoft.NET\Framework64... I certainly haven't deleted them, and other web services debug okay, so is this just a red herring?
We are also on a domain which has its own firewall (outside of the developers' control) - could this be blocking it?
EDIT: I have just removed the user impersonation for a quick test, and it worked. So there must be something about Visual Studio 2008 that does not want to run when impersonating THIS particular user. Any ideas what configuration I would need to change to correct this?
I have had the same issues with impersonation; I don't know if Cassini (the built-in VS web server) supports this properly. About the best advice I can give is to either use Local IIS with an app pool running as your impersonated user or to attach your debugger using remote debugging to a remote IIS server.
I believe using Local IIS will attach correctly & automatically if configured as much in the Web tab of Project Properties. You'll have to run VS as an admin to get the virtual directories setup automatically by VS in IIS.