dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.35k stars 9.99k forks source link

IISHTTPServer throws AccessViolationException: Attempted to read or write protected memory during StopAsync #23809

Closed lachlann562 closed 4 years ago

lachlann562 commented 4 years ago

Describe the bug

During a debugging session, when i started debugging the IIS failed to start in the required time limit, during the shutdown it raised an exception: AccessViolationException: 'Attempted to read or write protected memory.

I was using nlog with ElasticSearchTarget, it reached the stage of loading my home controller which had a debug point.

HTTP Error 500.37 - ANCM Failed to Start Within Startup Time Limit

To Reproduce

so far have not been able to create a minimal reproduction of this issue.

Exceptions (if any)

An unhandled exception of type 'System.AccessViolationException' occurred in Microsoft.AspNetCore.Server.IIS.dll
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

>   Microsoft.AspNetCore.Server.IIS.dll!Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.StopAsync(System.Threading.CancellationToken cancellationToken) Line 105 C#
    Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHost.StopAsync(System.Threading.CancellationToken cancellationToken) Line 339  C#
    Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHost.DisposeAsync() Line 367   C#
    Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token, string startupMessage) Line 141  C#
    Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token) Line 94  C#
    Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(Microsoft.AspNetCore.Hosting.IWebHost host) Line 68 C#
    MyApp.dll!MyApp.Main(string[] args) Line 43 C#

### Further technical details
- ASP.NET Core version
3.1
- Include the output of `dotnet --info`
- The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version
Microsoft Visual Studio Professional 2019
Version 16.6.2
VisualStudio.16.Release/16.6.2+30204.135
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Professional

.NET Portability Analyzer   1.1.10808.0
Evaluates portability of assemblies across .NET platforms.

ASP.NET and Web Tools 2019   16.6.948.25768
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2020603+b3ac44798c16fff5b95dbcfe62dea84aa9a1bd72
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019   16.6.948.25768
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.6.948.25768
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   16.6.948.25768
Azure Functions and Web Jobs Tools

C# Tools   3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CodeMaid   11.1.209
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

CreateUnitTestBoilerplateCommand Extension   1.0
CreateUnitTestBoilerplateCommand Visual Studio Extension Detailed Info

File Icons   2.7
Adds icons for files that are not recognized by Solution Explorer

Image Optimizer   4.0.132
Uses industry standard tools to optimize any JPEG, PNG and Gifs - including animated Gifs. Can do both lossy and lossless optimization.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30212.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.50+g25aae5a24a.R
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

NuGet Package Manager   5.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Open Command Line   2.4.229
2.4.229

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62006.03190
Microsoft SQL Server Data Tools

TypeScript Tools   16.0.20417.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.9.1.0 for F# 4.7   16.6.0-beta.20217.4+1c969cac25e2d38d71872efe6c8226029e42bb59
Microsoft Visual F# Tools 10.9.1.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions (Preview)   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

VSColorOutput   2.71
Color output for build and debug windows - https://mike-ward.net/vscoloroutput
BrennanConroy commented 4 years ago

Could you try upgrading to VS 16.6.3?

lachlann562 commented 4 years ago

will do and see if the same problem occurs, thanks.

On Fri, Jul 10, 2020 at 5:42 PM Brennan notifications@github.com wrote:

Could you try upgrading to VS 16.6.3?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnet/aspnetcore/issues/23809#issuecomment-656904339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3BRTI7JXYKJI7BM7WH5YDR26DKVANCNFSM4OVUWJLA .

--

ghost commented 4 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.