After retargeting to .NET Core 2.1 getting new error System.ObjectDisposedException: Cannot access a disposed...
up vote
0
down vote
favorite
I've just successfully retargeted my Web API app from .NET Framework 4.7.1 to .NET Core 2.1. The application runs perfectly on my local machine.
After deploying it to an Azure app service the app starts up and looks healthy. However I log the following error whenever I make any API call (including to receive static files).
Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLIFNSQMBR9Q", Request id "0HLIFNSQMBR9Q:0000000D": An unhandled exception was thrown by the application.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'FrameResponseStream'.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.ValidateState(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.WriteAsync(Byte buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.Write(Byte buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync()
at Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.ProcessRequestsAsync()
Unfortunately the above stack trace does not mention any of our code, and so I'm not entirely sure where this exception is coming from. This error did not occur when .NET Framework was targeted, so it must be related to the retargeting to .NET Core 2.1.
I have checked this StackOverflow question which also describes the exception after migrating to .NET Core 2.1, but I've tried looking for and fixing the situations described in the answers without success.
What could be causing this error and how can I fix it?
c# asp.net-core porting asp.net-core-2.1 objectdisposedexception
|
show 1 more comment
up vote
0
down vote
favorite
I've just successfully retargeted my Web API app from .NET Framework 4.7.1 to .NET Core 2.1. The application runs perfectly on my local machine.
After deploying it to an Azure app service the app starts up and looks healthy. However I log the following error whenever I make any API call (including to receive static files).
Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLIFNSQMBR9Q", Request id "0HLIFNSQMBR9Q:0000000D": An unhandled exception was thrown by the application.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'FrameResponseStream'.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.ValidateState(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.WriteAsync(Byte buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.Write(Byte buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync()
at Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.ProcessRequestsAsync()
Unfortunately the above stack trace does not mention any of our code, and so I'm not entirely sure where this exception is coming from. This error did not occur when .NET Framework was targeted, so it must be related to the retargeting to .NET Core 2.1.
I have checked this StackOverflow question which also describes the exception after migrating to .NET Core 2.1, but I've tried looking for and fixing the situations described in the answers without success.
What could be causing this error and how can I fix it?
c# asp.net-core porting asp.net-core-2.1 objectdisposedexception
1
Did you follow this? docs.microsoft.com/en-us/aspnet/core/migration/…
– Marie
2 days ago
Exception kinda gives you a hint which class is causing the issue:: Cannot access a disposed object. Object name: 'FrameResponseStream'
. Quick Google search forFrameResponseStream
ends up in github.com/aspnet/KestrelHttpServer/issues/2299 and a referenced issue which is about improving docs.microsoft.com/en-us/aspnet/core/fundamentals/… docs page. Does that give you enough direction?
– Tseng
2 days ago
Thanks @Marie I'll check it out. The article talks about upgrading from .NET Core 2.0 to 2.1 - we are going from targeting .NET Framework. Perhaps there is done useful information there though!
– Ivan
2 days ago
Hi @Tseng I have looked at all those links but I'm not sure that the suggested improvements to the docs give me any more direction - but I'll read it thoroughly and see if I can figure it out from there, thanks
– Ivan
2 days ago
You are not using Websockets anywhere, directly or indirectly (SignalR) or putting anything form a request into the background thread / service and not awaiting the middleware till that one is finished?
– Tseng
2 days ago
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I've just successfully retargeted my Web API app from .NET Framework 4.7.1 to .NET Core 2.1. The application runs perfectly on my local machine.
After deploying it to an Azure app service the app starts up and looks healthy. However I log the following error whenever I make any API call (including to receive static files).
Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLIFNSQMBR9Q", Request id "0HLIFNSQMBR9Q:0000000D": An unhandled exception was thrown by the application.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'FrameResponseStream'.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.ValidateState(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.WriteAsync(Byte buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.Write(Byte buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync()
at Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.ProcessRequestsAsync()
Unfortunately the above stack trace does not mention any of our code, and so I'm not entirely sure where this exception is coming from. This error did not occur when .NET Framework was targeted, so it must be related to the retargeting to .NET Core 2.1.
I have checked this StackOverflow question which also describes the exception after migrating to .NET Core 2.1, but I've tried looking for and fixing the situations described in the answers without success.
What could be causing this error and how can I fix it?
c# asp.net-core porting asp.net-core-2.1 objectdisposedexception
I've just successfully retargeted my Web API app from .NET Framework 4.7.1 to .NET Core 2.1. The application runs perfectly on my local machine.
After deploying it to an Azure app service the app starts up and looks healthy. However I log the following error whenever I make any API call (including to receive static files).
Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLIFNSQMBR9Q", Request id "0HLIFNSQMBR9Q:0000000D": An unhandled exception was thrown by the application.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'FrameResponseStream'.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.ValidateState(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.WriteAsync(Byte buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameResponseStream.Write(Byte buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync()
at Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.ProcessRequestsAsync()
Unfortunately the above stack trace does not mention any of our code, and so I'm not entirely sure where this exception is coming from. This error did not occur when .NET Framework was targeted, so it must be related to the retargeting to .NET Core 2.1.
I have checked this StackOverflow question which also describes the exception after migrating to .NET Core 2.1, but I've tried looking for and fixing the situations described in the answers without success.
What could be causing this error and how can I fix it?
c# asp.net-core porting asp.net-core-2.1 objectdisposedexception
c# asp.net-core porting asp.net-core-2.1 objectdisposedexception
asked 2 days ago
Ivan
2,47951847
2,47951847
1
Did you follow this? docs.microsoft.com/en-us/aspnet/core/migration/…
– Marie
2 days ago
Exception kinda gives you a hint which class is causing the issue:: Cannot access a disposed object. Object name: 'FrameResponseStream'
. Quick Google search forFrameResponseStream
ends up in github.com/aspnet/KestrelHttpServer/issues/2299 and a referenced issue which is about improving docs.microsoft.com/en-us/aspnet/core/fundamentals/… docs page. Does that give you enough direction?
– Tseng
2 days ago
Thanks @Marie I'll check it out. The article talks about upgrading from .NET Core 2.0 to 2.1 - we are going from targeting .NET Framework. Perhaps there is done useful information there though!
– Ivan
2 days ago
Hi @Tseng I have looked at all those links but I'm not sure that the suggested improvements to the docs give me any more direction - but I'll read it thoroughly and see if I can figure it out from there, thanks
– Ivan
2 days ago
You are not using Websockets anywhere, directly or indirectly (SignalR) or putting anything form a request into the background thread / service and not awaiting the middleware till that one is finished?
– Tseng
2 days ago
|
show 1 more comment
1
Did you follow this? docs.microsoft.com/en-us/aspnet/core/migration/…
– Marie
2 days ago
Exception kinda gives you a hint which class is causing the issue:: Cannot access a disposed object. Object name: 'FrameResponseStream'
. Quick Google search forFrameResponseStream
ends up in github.com/aspnet/KestrelHttpServer/issues/2299 and a referenced issue which is about improving docs.microsoft.com/en-us/aspnet/core/fundamentals/… docs page. Does that give you enough direction?
– Tseng
2 days ago
Thanks @Marie I'll check it out. The article talks about upgrading from .NET Core 2.0 to 2.1 - we are going from targeting .NET Framework. Perhaps there is done useful information there though!
– Ivan
2 days ago
Hi @Tseng I have looked at all those links but I'm not sure that the suggested improvements to the docs give me any more direction - but I'll read it thoroughly and see if I can figure it out from there, thanks
– Ivan
2 days ago
You are not using Websockets anywhere, directly or indirectly (SignalR) or putting anything form a request into the background thread / service and not awaiting the middleware till that one is finished?
– Tseng
2 days ago
1
1
Did you follow this? docs.microsoft.com/en-us/aspnet/core/migration/…
– Marie
2 days ago
Did you follow this? docs.microsoft.com/en-us/aspnet/core/migration/…
– Marie
2 days ago
Exception kinda gives you a hint which class is causing the issue:
: Cannot access a disposed object. Object name: 'FrameResponseStream'
. Quick Google search for FrameResponseStream
ends up in github.com/aspnet/KestrelHttpServer/issues/2299 and a referenced issue which is about improving docs.microsoft.com/en-us/aspnet/core/fundamentals/… docs page. Does that give you enough direction?– Tseng
2 days ago
Exception kinda gives you a hint which class is causing the issue:
: Cannot access a disposed object. Object name: 'FrameResponseStream'
. Quick Google search for FrameResponseStream
ends up in github.com/aspnet/KestrelHttpServer/issues/2299 and a referenced issue which is about improving docs.microsoft.com/en-us/aspnet/core/fundamentals/… docs page. Does that give you enough direction?– Tseng
2 days ago
Thanks @Marie I'll check it out. The article talks about upgrading from .NET Core 2.0 to 2.1 - we are going from targeting .NET Framework. Perhaps there is done useful information there though!
– Ivan
2 days ago
Thanks @Marie I'll check it out. The article talks about upgrading from .NET Core 2.0 to 2.1 - we are going from targeting .NET Framework. Perhaps there is done useful information there though!
– Ivan
2 days ago
Hi @Tseng I have looked at all those links but I'm not sure that the suggested improvements to the docs give me any more direction - but I'll read it thoroughly and see if I can figure it out from there, thanks
– Ivan
2 days ago
Hi @Tseng I have looked at all those links but I'm not sure that the suggested improvements to the docs give me any more direction - but I'll read it thoroughly and see if I can figure it out from there, thanks
– Ivan
2 days ago
You are not using Websockets anywhere, directly or indirectly (SignalR) or putting anything form a request into the background thread / service and not awaiting the middleware till that one is finished?
– Tseng
2 days ago
You are not using Websockets anywhere, directly or indirectly (SignalR) or putting anything form a request into the background thread / service and not awaiting the middleware till that one is finished?
– Tseng
2 days ago
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418149%2fafter-retargeting-to-net-core-2-1-getting-new-error-system-objectdisposedexcept%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Did you follow this? docs.microsoft.com/en-us/aspnet/core/migration/…
– Marie
2 days ago
Exception kinda gives you a hint which class is causing the issue:
: Cannot access a disposed object. Object name: 'FrameResponseStream'
. Quick Google search forFrameResponseStream
ends up in github.com/aspnet/KestrelHttpServer/issues/2299 and a referenced issue which is about improving docs.microsoft.com/en-us/aspnet/core/fundamentals/… docs page. Does that give you enough direction?– Tseng
2 days ago
Thanks @Marie I'll check it out. The article talks about upgrading from .NET Core 2.0 to 2.1 - we are going from targeting .NET Framework. Perhaps there is done useful information there though!
– Ivan
2 days ago
Hi @Tseng I have looked at all those links but I'm not sure that the suggested improvements to the docs give me any more direction - but I'll read it thoroughly and see if I can figure it out from there, thanks
– Ivan
2 days ago
You are not using Websockets anywhere, directly or indirectly (SignalR) or putting anything form a request into the background thread / service and not awaiting the middleware till that one is finished?
– Tseng
2 days ago