Last post Nov 15, 2017 11:01 AM by gtscdsi
Oct 30, 2017 02:39 PM|web-crossing|LINK
I've got this ASP.NET Core site (version 1.1.2 with target .NET Framework 4.6.1) that is hosted on a Windows Server 2008 R2 using the .NET Core Windows Server Hosting bundle. It works fine everywhere, except on Safari (11.0) on macOS (10.11.6) where it intermittently
gives the error "Failed to load resource: The network connection was lost.".
This error happens immediately, e.g. when POSTing a form. There is no delay or loading time. It is reproducible on different Macs. It does not happen with other browsers on the same Mac. Safari on the same Mac works fine with other sites (e.g. "old" ASP.NET
MVC applications on the same server). So this leads me to the conclusion that it has something to do with the combination of Safari and ASP.NET Core (with IIS/Kestrel reverse proxy) hosted on Windows Server.
Unfortunately I have no idea how to analyze this further, since Safari does not display any detailed error and nothing shows up in the log files on the server (the request is logged with HTTP 200).
Anyone having similar problems or ideas to analyse this further?
Oct 31, 2017 03:21 AM|Edward Z|LINK
How long and often will the connection lost between Core site and Safari? Did this issue happen on specific method on Core site?
Firstly, I would suggest you upgrade Safari to latest version.
Then, currently, Asp.net Core is recommended to migrated to Core 2.0, I suggest you create a new Core 2.0 site, host it on Server, and then check whether the connection was lost from Safari. If not, you may consider migrating your site to Core 2.0.
Oct 31, 2017 02:04 PM|bruce (sqlwork.com)|LINK
Oct 31, 2017 02:14 PM|web-crossing|LINK
I wanted to avoid a migration to ASP.NET Core 2 since I knew there would be problems, especially with all the changes regarding query handling in EF Core 2. I've done so now and it took me half a day to get rid of all the exceptions. I will now run a new
suite of tests with Safari.
Upgrading Safari is not an option, since I cannot ask every user of a public facing website to update their browser.
BTW: The site is using Forms Authentication.
Nov 01, 2017 01:31 AM|Edward Z|LINK
>>Safari on the same Mac works fine with other sites (e.g. "old" ASP.NET MVC applications on the same server).
Did the working old Asp.net MVC enable Form authentication?
>>This error happens immediately, e.g. when POSTing a form
Did this issue happen only under Post request? Did you send request by Ajax?
>>I will now run a new suite of tests with Safari.
If you have any update about the new test with Core 2.0 web site, please feel free to let us know.
Nov 02, 2017 08:13 AM|web-crossing|LINK
Unfortunately, the update to ASP.NET Core 2 didn't seem to help.
Further tests now confirmed that the problem happens only with POST requests.
And yes, all working classic ASP.NET MVC sites also use forms auth.
Here are 2 screenshots of the error from Safari Dev Tools:
Nov 03, 2017 05:25 AM|Edward Z|LINK
Did you mean Post requests failed under Asp.Net Core 2 with forms authentication?
In my option, there is no form authentication in Asp.net Core. Do you mean Cookie Authentication? Could you share us how you implement Forms authentication in Core Server side and client side?
Nov 05, 2017 03:03 PM|web-crossing|LINK
I've now moved the whole installation to a brand new Windows 2016 Server with ASP.NET Core 2 runtime and IIS Hosintg, but still the same error.
So yes, I was talking about ASP.NET Core Identity with Cookies, basically the "Individual User Accounts" variant from https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?tabs=visual-studio%2Caspnetcore2x.
My code is about the same.
Maybe it has something to do with authentication (I did not see the error yet on pages not using the [Authorize] attribute), but why should it lead to errors only on Safari? The only article I found mentioning a similar problem was https://hajekj.net/2017/03/20/cookie-size-and-cookie-authentication-in-asp-net-core/, but
I'm not sure it applies in my case (no large authentication ticket, not on Azure, no limited to POST, etc.)
Admittedly I'm stumped and don't have any idea what to try next.
Nov 06, 2017 03:06 AM|Edward Z|LINK
Thank you for posting.
I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.
Sorry for any inconvenience and have a nice day!
Nov 06, 2017 07:26 AM|web-crossing|LINK
Thanks a lot, I'll wait.
If anything new comes up I'll let you know.
Nov 08, 2017 10:00 AM|gtscdsi|LINK
It seems like a known issue on OSX.
After searching I found this "Chrome & Firefox just display whatever content was received & don't worry about the mismatch in content length. Safari, starting with Safari 7.0 on Mavericks' 10.9 is stricter about the response & treats the mismatch as
a "Failure to load resource" error. (If I had to guess they're probably trying to improve the speed so don't retry the resource and so don't get the file fully retrieved response that wget does). (http://apple.stackexchange.com/questions/106550/safari-7-0-cannot-load-localhost"
And this for your reference: "https://github.com/woocommerce/woocommerce/issues/7176 "
Considering your question falls into a category which requires a more in-depth level of support. Please visit the below link to see the various free and paid support options that are available to better meet your needs.
Nov 10, 2017 11:33 AM|web-crossing|LINK
It seems like disabling keep alive solves the problem on Safari.
Is there a way to selectively disable keep alive only for Safari in IIS?
Nov 15, 2017 11:01 AM|gtscdsi|LINK
So far IIS cannot disable keep alive only for Safari.