Running and Debugging ASP.NET Core Apps in IIS Express – Help | JetBrains Rider
Nội Dung Chính
Running and Debugging ASP.NET Core Apps in IIS Express
Running and Debugging ASP.NET Core Apps in IIS Express only works on Windows.
Before you start
Download and install IIS Express.
IIS Express does not host ASP.NET Core applications natively, instead it uses a special integration module for that. Usually this module is installed as part of Visual Studio installation, but it is also available as part of .NET Core Hosting Bundle.
You can check if you have the module in your IIS Express configuration file (%PROGRAMFILES(x86)%\IIS Express\config\templates\PersonalWebServer\applicationhost.configs). If there is at least one of the following lines, then you have the module installed:<add name=”AspNetCoreModule”…
<add name=”AspNetCoreModuleV2″…If everything is configured correctly, JetBrains Rider will automatically find all necessary components. You can check their paths on the Build, Execution, Deployment | IIS Express page of JetBrains Rider settings Ctrl+Alt+S:
In case IIS Express does not start or returns an empty error, there is a chance the .NET Core Hosting Bundle did not install correctly. This article (under Fixing the applicationhost.config template) may help troubleshoot and fix the default IIS Express configuration template on your machine.
Run/debug configurations
After creating a new ASP.NET Core project or loading an existing one that has a launchSettings.json file with one or more IIS Express profiles, JetBrains Rider will automatically create run/debug configurations based on those profiles.
You can view and edit created configurations either in the Run/Debug Configurations dialog (Run | Edit Configurations) or on the toolbar selector:
For IIS Express profiles, the run configuration includes a few additional options:
Generate applicationhost.config
To launch IIS Express with your ASP.NET Core application, JetBrains Rider uses a configuration file .idea/config/applicationhost.config, which is created using a template that ships with IIS Express. When possible, customizations you make to this file are also preserved. You might want to dispable this option for heavy customizations.
Show IIS Express output
This option enables output from the IIS Express process. By default, it is disabled (as the output is quite verbose), but when enabled we can see additional details when running the application:
Send debug request
When this option is enabled, JetBrains Rider will send an initial request (with a DEBUG
HTTP request method) to the target ASP.NET Core application. This ensures the application is started and the debugger is attached, even when the browser is not started.
Additional IIS Express arguments
This field lets you pass additional arguments to the IIS Express host (for example, to enable request tracing).
As with other launchSettings-based run configurations, you can specify the target framework and additional runtime arguments using this dialog, but some IIS Express-specific options should be configured directly in the launchSettings.json file.
Running and debugging
Once everything is installed and configured, you can run your project Ctrl+F5 or set breakpoints (even in application startup, for example in Configure
/ConfigureServices
methods) and then debug your code Alt+F5.
Generating a self-signed SSL certificate
For launchSettings-based run configurations, JetBrains Rider will check whether an ASP.NET Core developer certificate or IIS Express self-signed certificate is set up on your machine. If not, you will see a notification which also let you generate one:
Setting up a certificate can be done from that warning, or with the Set up certificate action, which you can find using Find Action Ctrl+Shift+A.
For ASP.NET Core, JetBrains Rider will use the dotnet dev-certs https
command to check whether the certificate has been installed. For IIS Express, it will check the http.sys certificate settings (similar to the netsh http show sslcert
command line).
It also verifies the certificate is trusted by our system. This should make it easier to develop ASP.NET and ASP.NET Core web applications that make use of SSL on our developer machine.
Last modified: 29 November 2019