aspnet / Hosting

[Archived] Code for hosting and starting up an ASP.NET Core application. Project moved to https://github.com/aspnet/Extensions and https://github.com/aspnet/AspNetCore
Apache License 2.0
553 stars 312 forks source link

RC2 IISExpress: Error -4092 EACCES permission denied #753

Closed kspearrin closed 8 years ago

kspearrin commented 8 years ago

After moving from RC1 to RC2 I am getting the following error when trying to start up the application via VS on IISExpress:

Error -4092 EACCES permission denied

   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Microsoft.AspNetCore.Server.Kestrel.KestrelEngine.CreateServer(ServerAddress address)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at Program.Main(String[] args) in Program.cs:line 21

Screenshot: http://puu.sh/oXATq/7a0ff5aba4.png

Running the application via the Project "Web" command runs just fine. This is just an issue when running via IISExpress. I have tried changing the port (4009 currently), deleting bin/obj folders, deleting .vs folder, deleting project.lock.json without success. Any idea what's going on here?

launchSettings.json:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:4009/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Web": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

project.json:

{
    "description": "Web",
    "authors": [ "me" ],
    "userSecretsId": "aspnet5-Web",
    "version": "1.0.0-*",

    "dependencies": {
        "Core": {
            "version": "1.0.0-*",
            "target": "project"
        },
        "Microsoft.AspNetCore.Razor.Tools": {
            "version": "1.0.0-preview1-final",
            "type": "build"
        },
        "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
        "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-rc2-final",
        "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.FileExtensions": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "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",
        "Microsoft.AspNetCore.Localization": "1.0.0-rc2-final",
        "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
        "Microsoft.Extensions.Configuration.Binder": "1.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": {
        "netframework461": {
            "imports": [ "dnx451", "dnx461" ]
        }
    },

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

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

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

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

web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
  </system.webServer>
</configuration>

Program.cs

    public class Program
    {
        public static void Main( string[] args )
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot( Directory.GetCurrentDirectory() )
                .UseIISIntegration()
                .UseStartup<Startup>()
                .Build();

            host.Run(); // ---ERROR HAPPENS HERE---
        }
    }
Tratcher commented 8 years ago

This is probably a duplicate of https://github.com/aspnet/IISIntegration/issues/176 where the project name Web causes issues.

kspearrin commented 8 years ago

That is correct. This project is named "Web". Only workaround is to rename the project at the moment?

davidfowl commented 8 years ago

Rename the project.

kspearrin commented 8 years ago

For others: Confirmed renaming the project solves the issue (directory structure can remain in place). Also had to delete the .vs folder and bin/obj to "reset" the config bindings.

muratg commented 8 years ago

Dup of https://github.com/aspnet/IISIntegration/issues/176

muratg commented 8 years ago

https://github.com/aspnet/IISIntegration/issues/176