Empty WebApi 2 project throws StackOverflow Exception in VS2017 15.2(26430.12)

0

I'm Using Visual Studio 2017 15.2(26430.12)
I create a WebApi 2 Empty Project
Then add a controller as the following:

public class DefaultController : ApiController
{
    // GET: api/Default
    public IEnumerable<string> Get()
    {
        return new string[] { "value1", "value2" };
    }

    // GET: api/Default/5
    public string Get(int id)
    {
        return "value";
    }

    // POST: api/Default
    public void Post([FromBody]string value)
    {
    }

    // PUT: api/Default/5
    public void Put(int id, [FromBody]string value)
    {
    }

    // DELETE: api/Default/5
    public void Delete(int id)
    {
    }
}

Without any other changes, I start the project, When I navigate to http://localhost:51989/api/Default/following exception occurred! Without any details
What's wrong with it? WebApi 2 Empty project stackoverflow

Details from windows Event viewer:

Faulting application name: iisexpress.exe, version: 10.0.14358.1000, time stamp: 0x574fc56b
Faulting module name: iiscore.dll, version: 10.0.14358.1000, time stamp: 0x574fc56c
Exception code: 0xc00000fd
Fault offset: 0x00018992
Faulting process id: 0x794
Faulting application start time: 0x01d2e6c78b37e814
Faulting application path: C:\Program Files (x86)\IIS Express\iisexpress.exe
Faulting module path: C:\Program Files (x86)\IIS Express\iiscore.dll
Report Id: 088d1dfb-6a5d-4fcb-bfab-e85185d1c6a5
Faulting package full name: 
Faulting package-relative application ID: 

Edit:
Project Web.config

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <appSettings></appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
      <remove name="OPTIONSVerbHandler"/>
      <remove name="TRACEVerbHandler"/>
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler"
        preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>
c#
asp.net-web-api
asp.net-web-api2
webapi2
asked on Stack Overflow Jun 16, 2017 by Mohammad Dayyan • edited Jun 16, 2017 by Mohammad Dayyan

1 Answer

2

For what it's worth, using the same VS version as you, and on Windows 10, I was able to create the test app and play it without encountering this issue. I am also using the same version of IIS express. I don't think anything is wrong with the scaffolded code. If one exists, could you try deleting the (hidden) .vs directory in your solution's root directory and see if that relieves the issue? I've seen oddities arise before due to differences in applicationhost.config between the solution's .vs directory and your own Documents\IISExpress directory. There is also a similar thread about a similar issue which offers additional debugging advice here: IIS Express crashes when starting a site from visual studio

answered on Stack Overflow Jun 16, 2017 by Trioj • edited Jun 16, 2017 by Trioj

User contributions licensed under CC BY-SA 3.0