Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start ASP.NET Core RC2 web application in IISExpress

I created a new "ASP.NET Core Web Application (.NET Core)" project in VS2015. It built without any issues, so I thought to give it a test run. However, when starting up, it choked and crashed with the following error:

Exception thrown: 'System.AggregateException' in Microsoft.AspNetCore.Server.Kestrel.dll
The program '[11608] dotnet.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
The program '[15048] iisexpress.exe' has exited with code 0 (0x0).

I don't see anything else logged. I tried debugging it, and all I found out was that it broke during the WebHostBuilder.Run() method in Program class. It is part of the framework, so I wasn't able to get much further.

Note that the program runs fine when running via dotnet run command. Only IISExpress does not work.

How should I go about debugging this issue?

The project.json file is below. (It was generated by Visual Studio, I did not change anything.)

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final"
  },

  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

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

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

  "runtimeOptions": {
    "gcServer": true
  },

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

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

Update: I created a new project for the Core RTM release, and this time it worked.

like image 989
painiyff Avatar asked May 19 '16 16:05

painiyff


3 Answers

The other issue is that you might be running an old version of the framework. Try going to the root (project.json) location of your runnable project and in a Command Prompt type:

dotnet run
like image 178
Serj Sagan Avatar answered Oct 06 '22 22:10

Serj Sagan


I had the same problem as you. For me the solution was to close VS2015, delete the file project.lock.json and then restart VS again. (project.lock.json will be generated automatically)

It looks like the debugger cannot attach to the application. In my case I added a throw new Exception("..."); in the first line of the function public Startup(IHostingEnvironment env) and the application just dies and doesn't break on the unhandled exception as expected.

After project.lock.json was rebuilt the debugger works fine again.

like image 45
MDummy Avatar answered Oct 06 '22 22:10

MDummy


I updated to the RTM release of dotnet core and creating a new project using the new version worked. I guess it must be a bug.

like image 32
painiyff Avatar answered Oct 06 '22 23:10

painiyff