Hosting icon indicating copy to clipboard operation
Hosting copied to clipboard

Cannot host ASP.NET Core Web Application (.NET Framework)

Open gisek opened this issue 10 years ago • 21 comments

Environment: VS 2015 Community with Update 2 .NET Core RC2 SDK Preview 1 newest nuget

I create a brand new project (tested on .net 4.6 and 4.6.1) named "Test".

For: Cannot host ASP.NET Core Web Application (.NET Core) - application starts properly

For: Cannot host ASP.NET Core Web Application (.NET Framework) - application never starts. It just hangs with the message:

starting_server

After I click cancel and even close VS the file bin\Debug\net46\win7-x64\Test.exe is stil used by some process. It blocks the next build. I can't delete it until I restart my machine.: Error Failed to make the following project runnable: Test (.NETFramework,Version=v4.6.1) reason: The process cannot access the file 'Path\To\WebApplication2\src\Test\bin\Debug\net461\win7-x64\Test.exe' because it is being used by another process. Test C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241 Build

dotnet run supposedly starts the application, but it's not listening on ports from launchSettings.json

Is ASP.NET Core Web Application (.NET Framework) supposed to work, or is it some kind of bug? Is there a way around it?

gisek avatar Jun 07 '16 23:06 gisek

dotnet run does not know about lauchsettings.json, that's a VS artifact. The console should show you the address it started on.

Tratcher avatar Jun 07 '16 23:06 Tratcher

@Tratcher This is all I see after running dotnet run

image

gisek avatar Jun 08 '16 08:06 gisek

@gisek what happens if you run the published exe directly?

muratg avatar Jun 09 '16 16:06 muratg

@muratg For every Test.exe located in the following directories, the console just hangs with no output at all. Not sure how to check if it's listening on any port.

Path\To\Project\src\Test\bin\Debug\net461\Test.exe Path\To\Project\src\Test\bin\Debug\net461\win7-x64\Test.exe Path\To\Project\src\Test\bin\Debug\net461\win7-x64\publish\Test.exe

gisek avatar Jun 09 '16 17:06 gisek

@gisek What's your OS version? I'm not able to reproduce on my machine.

muratg avatar Jun 09 '16 22:06 muratg

@muratg It's Windows 10 with all the updates

gisek avatar Jun 09 '16 22:06 gisek

I had the same thing happening after the upgrade. (Win10 - all up to date)

Was able to follow this article http://stackoverflow.com/questions/37494297/asp-net-core-starting-the-web-server-is-taking-longer-than-expected to fix the problem, specifically the solution to remove old data protection reference.

But now VS hangs on "Debug is starting." Even with a completely fresh new aspnetcore website (From new project template)

I realize this is probably a different issue, but if @gisek has the same thing happen after making the fix then there would be a common thread to understand and if not I hope the article helps him.

esargent avatar Jun 10 '16 21:06 esargent

@eerhardt I'm not sure if it's the same case. When I follow the instructions form the Stackoverflow link, a new Chrome card opens up, but it's http, not https. Also there's no popup.

image

gisek avatar Jun 11 '16 00:06 gisek

A little update. For my colleague, who has the same software configuration it works fine.

gisek avatar Jun 13 '16 21:06 gisek

@gisek Were you ever able to get to the bottom of this?

muratg avatar Jun 28 '16 16:06 muratg

@gisek (Also, could you try to upgrade to RTM bits?)

muratg avatar Jun 29 '16 21:06 muratg

We have 5 developers here and 2 machines were having this issue. According to "Extensions and Updates" all updates had been applied however that was not true for the machines with issues.

Assuming you're running an x64 system, just install all these updates and everything should just work.

  1. Make sure you’re using the latest update for VS2015 (Update 3) http://go.microsoft.com/fwlink/?LinkId=691129
  2. Make sure you have the latest version of the SDK (DotNetCore.1.0.0-SDK.Preview2-x64) https://go.microsoft.com/fwlink/?LinkID=809122
  3. Make sure you have the latest version of the VS Tools (DotNetCore.1.0.0-VS2015Tools.Preview2) https://go.microsoft.com/fwlink/?LinkId=817245

tpanthier avatar Jun 29 '16 23:06 tpanthier

@muratg Sorry, it took me so long to answear. I've just installed VS update 3 along with the latest DotNetCore tools. It didn't help though. :(

After that i tried to install everything @tpanthier listed, but it turned out it all had been already installed.

The error now looks like that: image

This locked application file seems to be the problem to me.:

Error Failed to make the following project runnable: Test (.NETFramework,Version=v4.6.1) reason: The process cannot access the file 'Path\To\WebApplication2\src\Test\bin\Debug\net461\win7-x64\Test.exe' because it is being used by another process. Test C:\Program Files

Which process is supposed to use it? It's not VS (restart doesn't free the file). Killing dotnet process doesn't help either. So far only system restart frees it.

gisek avatar Jul 09 '16 20:07 gisek

@gisek Did you uninstall everything else before installing the VS update, and Preview 2 tooling?

muratg avatar Jul 11 '16 15:07 muratg

@muratg I did not. What exactly should I uninstall?

  • VS
  • DotNetCore.1.0.0-SDK.Preview2-x64
  • DotNetCore.1.0.0-VS2015Tools.Preview2

Anything more?

gisek avatar Jul 11 '16 16:07 gisek

@gisek Those should be OK, did you have Preview1 bits (or earlier) on your machine before installing Preview 2?

muratg avatar Jul 11 '16 17:07 muratg

@muratg I had RC1 (which worked fine) RC2 preview1 (which didn't work), now I have RC2 preview2 (which doesn'r work)

I'll give the reinstallation a shot later this week and I'll let you know.

gisek avatar Jul 11 '16 23:07 gisek

I'm having the same problem: VS hangs on "Debug is starting."

Visual Studio Community 2015 (Version 14.0.25421.03 Update 3) Project: ASP.NET Core Web Application (.NET Core)

PM> dotnet --info .NET Command Line Tools (1.0.0-preview2-003121)

Product Information: Version: 1.0.0-preview2-003121 Commit SHA-1 hash: 1e9d529bc5

Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64

What should I do?

marceloodiniz avatar Jul 15 '16 01:07 marceloodiniz

@muratg Reinstalling things listed above (and uninstalling stuff from RC1) did the job. Thanks! @madskristensen good luck!

gisek avatar Jul 17 '16 21:07 gisek

@gisek sounds great!

muratg avatar Jul 19 '16 15:07 muratg