Aspnetcore: Can't start with F5 using IIS Express

Created on 28 Jun 2016  路  31Comments  路  Source: dotnet/aspnetcore

File new project -> AspNet Core -> F5, works fine, turn on SSL binding, still works.

When I do the same when migrating from RC2 I get:
An error occured attempting to determine the process id of dotnet.exe which is hosting your application. One or more errors occured.

I can start without debugging (ctrl+F5) and then attach the debugger without a problem. Using kestrel works fine as well.

I don't get any log messages even though logging is enabled.
I've tried the following:
Shut down VS
Delete .vs folder
Delete bin and obj folders
Delete user-files for xproj
Delete lock files
Toggling Enabled SSL to get a new port
Tried without SSL, same problem
Explicitly run dotnet restore
Restarted computer

Still same problem.

I've totally removed the source folder and done a clean checkout, still same problem. Something's obviously different from the file new project, can't tell what though. xproj, web.config, global.json and project.json looks identical.

Most helpful comment

All 31 comments

How to reproduce:

  1. File new project
  2. Enable SSL
  3. Copy SSL URL to App URL
  4. F5

I have the same issue when upgrading from RC2 to RTM.

I had the same issue. Tried similar steps

  • shut down vs
  • deleted .vs folder
  • deleted project.lock.json

- deleted Properties/launchSettings.json

  • re-added enable ssl

opened the project (that was previously rc2) and F5 worked finally!

Nevermind. I hadn't copied the ssl url into the app url.
Once I did, the error is back.

If the App Url has https:// no matter what, the error occurs.
Whether SSL is enabled or not.

When you start the site without debugging and load the page in IE do you get a certificate error?

Yes. Certificate error when running without debug.

Try these instructions and see if it A) fixes your cert error in IE, and B) fixes your debug error.
https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/how-to-trust-the-iis-express-self-signed-certificate

I installed the IIS Express localhost cert and the problem is fixed for both the cert error and debugging.
Thanks!

I did have to switch to IE briefly as both Chrome and Edge wouldn't give me the option to install the cert, only view it. Once installed, chrome still shows a certificate error (net::ERR_CERT_AUTHORITY_INVALID) but debugging is still ok.

@mikecowgill Chrome appears to be caching the cert. The error goes away eventually.

Thanks! It works!

Cool, works with localhost CA installed in trusted root, thanks! Perhaps worth mentioning this in breaking changes.

Awesome! This worked for me as well

@shirhatti

This worked for me, thank you.

@Tratcher thank you. https://support.microsoft.com/en-us/kb/3180222 worked (just ran the powershell script)

A simple solution, worked for me was press ctrl+shift+w (View in Browser) then VS asked automatically to trust and install the certificate, without any script.

We had similar issue. Turns out the error is because the Web Server Settings / App URL is being checked into source control and each developer has his own unique URL (dev1.foo.com vs dev2.foo.com). Can't use localhost because of cookie flow issues. Would be nice if there was an option to make that a per user setting vs a global setting.

Got the same error today. Somehow the sslPort property was set to 0 in the launchSettings.json..... I changed it back to the ssl port and everything worked fine again.

Hi, I'm getting this error, the support link no longer exists, and I cannot click to install the certificate because the page never even launches.

I ran into this again after installing _VS2017 Update 3 Preview 3_ side by side with _VS2017 Update 2_.
I believe what fixed it (I tried a lot of different things) was to delete the IIS Express cert entirely from the certificate manager (I had previously added it to the trusted root), and then repair IIS Express 10 from the Programs and Features (Add/Remove Programs). After which found the cert again in the Certificate manager's Personal Certificates section. Move the IIS Express Development Certificate for localhost to Trusted Root Certificate Authorities and it all works again.

Nick Albrecht, your solution worked for me. I didn't have to uninstall the cert, just dragged it into the Trusted Root Certificate Authorities and it worked. Thanks.

Where is this >> Move the IIS Express Development Certificate for localhost to Trusted Root Certificate Authorities

Please perform the following steps:

  1. Do a search for Certificates, and choose "Manage Computer Certificates" from the results.
  2. Expand both the Personal and Trusted Root Certification folders on the left sidebar.
  3. Select the Certificates folder under Personal.
  4. Drag and drop the localhost certificate found there onto the Certificates folder under Trusted Root Certification.

certificates

Thanks jeremyhoesly , your instructions worked perfectly for me.

I had redirect rules from http to https (for production) in my web.config. Had forgot to deactivate them when running locally.

I am currently getting this error and I do not have a certificate error, nor do I have SSL enabled. My app is hosted in IIS (not IISExpress).

If I follow the instructions above, I do not have a IIS Express development certificate in my personal or trusted root certificate stores.

web.Config:
image

launchSettings.json:

image

I only get the issue when trying to debug, running without debug works fine.
I still get the problem if i switch from IIS to IISExpress.

I can start without debugging, and then manually attach the debugger to my applications .exe and that works fine. Attaching the debugger to the w3wp.exe has no effect (not sure if that is the correct method anyway).

Does anyone have any guidance on what I might need to check?

SOLVED
I happened upon this comment here
https://stackoverflow.com/a/42294686/2064829

That suggested deleting the .vs folder located in the root folder of the solution.
This appears to have solved the problem for me.

Solved by deleting the .vs folder

solved by deleting redirect rule from web.config

 <!-- IIS URL Rewrite to redirect HTTP to HTTPS -->
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
        </rule>

I had the same issue. Tried similar steps

  • shut down vs
  • deleted .vs folder
  • deleted project.lock.json

- deleted Properties/launchSettings.json

  • re-added enable ssl

opened the project (that was previously rc2) and F5 worked finally!

This worked for me. thanks.

Was this page helpful?
0 / 5 - 0 ratings