February 23, 2020

HTTP Error 500.30–ANCM In-Process Start Failure

I faced following error when I deployed .Net Core Web Application to my local IIS server.

 HTTP Error 500.30–ANCM In-Process Start Failure 

It doest not provide a direct cause and can be very frustrating when trying to get that app ready for production.

While searching for this, I found a number of common causes for this error:

  • The application failed to start
  • The application started but then stopped
  • The application started but threw an exception during startup

These are some options you can try to find out the root cause for this issue.

  1. Attach a debugger to the application process.

  2. Check the event log for error messages from Event Viewer. Go to Event Viewer > Windows Logs > Application. You will found an Error with Source column's value as IIS AspNetCore Module, IIS Express AspNetCore Module, IIS AspNetCore Module V2 or IIS Express AspNetCore Module V2.

  3. Enable logging the application through stdout messages. Go to project's root folder, open web.config file. You will find the aspNetCore tag:

    <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
      

    Set stdoutLogEnabled value to true, and put logs folder path in stdoutLogFile. Ensure that your application pool’s identity account has write permissions to the logs folder. After you make a request to the application, look in the logs folder and check the latest log file for errors.

    Once you find the root cause of the problem, make sure to reset stdoutLogEnabled to false in the web.config file to turn off logging.

  4. Open the command prompt and navigate to the application's root folder, and execute the application's assembly with dotnet.

    dotnet .\<assembly_name>.dll 
      

    Substitute <assembly_name> with the name of the application.

    If there is any error that occurred at the startup of the application, it will be written in the console output.

    Also try making a request to the web app by navigating to the url in browser. If there is any error in processing the request, it will be displayed on console output. If there are no errors, the problem is might be related to the hosting configuration and not the application.

February 20, 2020

Assets file project.assets.json not found. Run a NuGet package restore

In Visual Studio 2017, while working with .Net Core Web Applications, I encountered this error:

Assets file project.assets.json not found. Run a NuGet package restore

While searching for this, I found a number of options you can try to fix this issue.

  1. Simplest of the solution could be just to close and re-open the Visual Studio, in some cases this might help.

  2. Another thing could be simply delete the bin and obj folders, clean and rebuild the solution.

  3. Go to Tools > NuGet Package Manager > Package Manager Console, and run this command:

    dotnet restore
    

    Or for specific project:

    dotnet restore [project or solution name]
    

    Executing dotnet restore adds all the required files.

  4. If simply restoring NuGet packages does not work make sure in Tools > Options > NuGet Package Manager > General under Package Restore that the Allow NuGet to download missing packages is checked.

    Then try restore packages, and rebuild after deleting obj and bin folders

  5. Try clearing the Nuget cache.

    Go to Tools > Options > NuGet Package Maneger > General > click on Clear All Nuget Cache(s)

  6. Run command dotnet build.

    dotnet build
    

    It runs the restore by default.