An error occurred attempting to determine the process id of dotnet.exe which is hosting your application. One or more error occured

C#asp.netasp.net Mvcasp.net Core

C# Problem Overview


I have clone the project from source url. My friend has developed the asp.net core web application using .NetCore 1.0.0-preview2-003121 sdk. However on my pc I have install .NetCore 1.0.1-preview2-003131 sdk. I am getting the error. I changed the version in the global.json file as you can see below but still no solution.I google it but all the solution are not working for me.

Global.json file

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

Project.json

{
  "userSecretsId": "aspnet-FMM-02f339eb-4af7-42c9-b7f3-d05b48d36811",

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Identity": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.EntityFrameworkCore.Relational": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
    "Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0",
    "MailKit": "1.8.1",
    "NLog.Extensions.Logging": "1.0.0-*",
    "System.Data.SqlClient": "4.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "xmlDoc": false
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config",
      "nlog.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Dot net version in my pc

How can I solve this issue. Please can anyone let me know about this. [enter image description here

[enter image description here

C# Solutions


Solution 1 - C#

> An error occurred attempting to determine the process id of dotnet.exe which is hosting your application. One or more errors occurred.

That problem can occur when three things are true:

  1. your app is trying to run with SSL,
  2. your app does not have an SSL Certificate setup, and
  3. you are debugging your app (which is preventing SSL certificate setup).

As a quick fix attempt, run the app without debugging via Ctrl + F5 or view the app in the browser via Ctrl + Shift + W. That might install the SSL certificate for you. If it does not, consider changing your app's launch settings from HTTPS to HTTP. If you really need SSL, you'll have to figure out how to install and use an SSL certificate on your local machine.

Checkout out these on GitHub and StackOverflow.

Solution 2 - C#

Note that for IIS Express to work with SSL, the port needs to be in the 44300 through 44399 range (from https://stackoverflow.com/questions/20036984/how-do-i-fix-a-missing-iis-express-ssl-certificate/38094929#38094929 -original article https://docs.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-without-administrative-privileges)

For other ports Visual Studio 2017 didn't install the SSL Certificate, but I was able to install it as suggested in https://stackoverflow.com/questions/20036984/how-do-i-fix-a-missing-iis-express-ssl-certificate/38220369#38220369

> From an elevated command prompt run (specify your port number):

    cd "C:\Program Files (x86)\IIS Express"
    IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:55555/ -UseSelfSigned

Edit:

Then browse to the website https://localhost:44348/ (using FF) and if you're prompted add the security exception.

Solution 3 - C#

This may happen when you try to run your application with the "Enable SSL" setting enabled, and if the self-signed certificate has not been installed as a trusted root certificate.

To fix, follow these steps:

  1. Press CTRLF5 to start your application and have VS create the self-signed certificate.
  2. If the application did not start in Internet Explorer, open an IE window and copy/paste the start URL into that window.
  3. IE will display a certificate warning. Click "Continue to this website."
  4. Click on the red certificate error symbol in the address bar and then "View certificates".
  5. In the dialog that opens click "Install certificate...".
  6. In the certification installation dialog choose "Local machine", (not "Current user"), then click "Next".
  7. Select "Place all certificates into the following store" and in the "Browse..." dialog, select "Trusted Root Certification Authorities".
  8. Complete the installation dialog, then close and reopen the browser tab. Now no certificate error should be displayed.

You are all set now to run your project with F5 in debug mode.

Solution 4 - C#

I had this same issue, eventually realizing that I had set up an HTTPS URL Rewrite in my application's web.config for use in production. However, I didn't want to mess with SSL in my dev environment, so I decided to remove it.

After deleting the section and attempting to debug the app again, I noticed that Chrome kept redirecting my localhost to HTTPS, in spite of the fact that I hadn't selected "Enable SSL" in the application properties.

What finally got my app debugging locally in HTTP again was clearing my Chrome cache.

Hope this helps someone else who's stuck!

Solution 5 - C#

Please remember always to declare your new IIS Web Site in hosts file inside System32 folder if you are using Windows. This was my case, feeling dump!

Solution 6 - C#

I encountered the same error. In my case I overlooked the fact that I had URL Re-Write rules in my web.config file (doh). Commenting out the re-write rule fixed the issue.

<system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect to Https" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

Solution 7 - C#

I have a .NET Core app and I had accidentally changed my IIS settings launchSettings.json to use https instead of http. Reverting that change automatically fixed my issue.

Solution 8 - C#

by adding in .csproj file in PropertyGroup solved this issue for me

<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>

Solution 9 - C#

In my case, the problem arised because of redirect rule in web.config (http -> https). Try to disable redirect rule and check if it works.

Solution 10 - C#

In my project, I fixed this error by changing the Hosting Model as In Process. Please go in the startup solution's properties area and change it to In Process and then try. In my case, it was not fixed by deleting bin and obj several times but changing this hosting model fixed issue at my end. Please follow this screen shot :

enter image description here

Happy coding :)

Solution 11 - C#

If you are using IIS (not Express) a simple Stop and Start of it did the work.

Solution 12 - C#

I solved it by doing the following steps:

  • Copying the appsettings.Development.json from the Solution folder to \bin\Debug\netcoreapp2.0
  • Rename it to appsettings.json

Worked like a charm for me.

Solution 13 - C#

I fixed this by doing:

CMD:

netsh http add iplisten ipaddress=192.168.xxx.xxx

then control + c to exist, then iisreset

Solution 14 - C#

I ran into the same issue and what i did to fix was in my launchSettings.json I added this line of code and do not change the http to https or you will get the same error

"iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:add your localhost Id", "sslPort": 44342 }

Solution 15 - C#

Make sure your IP address hasn't changed (if using a DNS name)

Whether using 'real DNS' or an override in hosts make sure your local IP hasn't changed.

If you're using NAT and you don't have a fixed local IP assigned to your machine this is very easy to do. In fact it could be months before you are issued with a new IP making it all the more confusing!

I had an entry

192.168.1.134 dev.example.com

in my hosts file, but my local IP changed to 192.168.1.136.

You can probably use 127.0.0.1 instead.

After fixing this for my case I had to restart Visual Studio, and also full IIS (not sure why).

PS. I actually set 192.168.1.134 in my 'real DNS' to facilitate testing on mobile devices with a proper DNS name and certificate. So when this changes it breaks.

Solution 16 - C#

Make sure you don't have a proxy enabled for LAN

Other answers are great but I got this error after a restart following a crash. When Windows crashed it was running Fiddler, which registers itself as a LAN proxy. Fiddler cannot unregister itself due to crash and when windows boots browsers etc work but LAN proxy setting is now messing up access to IIS Express (would probably mess with IIS too)

So make sure you don't have a local proxy configured in your Internet options

Solution 17 - C#

I could not get IIS Express to run using HTTPS, but I was able to make it work using the 'webApp' profile (launch as project). From command line, I had to run:

dotnet dev-certs https --trust

--trust is optional but will prevent browser warnings for an untrusted cert.

Solution 18 - C#

I had the same issue tried almost all solutions mentioned here but then eventually found that I have an error in error list after resolving the issue I was able to run my project.

Solution 19 - C#

After seeing Shaun Luttin correct answer I found my issue.

I had rewrite rules in the web.config which I forgot to comment out when debugging, and then uncomment it when deploying to 'auto' redirect to HTTPS always.

(MVC Core 3.1 with web.config)

Following was the issue:

<rewrite>
      <rules>
        <clear />
        <rule name="Redirect to https" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>

Solution 20 - C#

I was not using SSL so the cause was most likely something else. For me it worked if I ran Visual Studio as an administrator.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSan JaisyView Question on Stackoverflow
Solution 1 - C#Shaun LuttinView Answer on Stackoverflow
Solution 2 - C#Michael FreidgeimView Answer on Stackoverflow
Solution 3 - C#ChristophView Answer on Stackoverflow
Solution 4 - C#Ben WaltersView Answer on Stackoverflow
Solution 5 - C#agerohView Answer on Stackoverflow
Solution 6 - C#BDarleyView Answer on Stackoverflow
Solution 7 - C#thielyricsView Answer on Stackoverflow
Solution 8 - C#ImranView Answer on Stackoverflow
Solution 9 - C#Pavel MelnikovView Answer on Stackoverflow
Solution 10 - C#Ankita_systematixView Answer on Stackoverflow
Solution 11 - C#gnericView Answer on Stackoverflow
Solution 12 - C#kidra.pazzoView Answer on Stackoverflow
Solution 13 - C#Jake SteeleView Answer on Stackoverflow
Solution 14 - C#Clarence WilsonView Answer on Stackoverflow
Solution 15 - C#Simon_WeaverView Answer on Stackoverflow
Solution 16 - C#mahonyaView Answer on Stackoverflow
Solution 17 - C#Christopher DunnView Answer on Stackoverflow
Solution 18 - C#Aneeq Azam KhanView Answer on Stackoverflow
Solution 19 - C#MastamaView Answer on Stackoverflow
Solution 20 - C#Sanny JacobssonView Answer on Stackoverflow