Aspnetcore: Blazor Server-side doesn't start with Windows Authentication on Chrome

Created on 27 Aug 2019  路  8Comments  路  Source: dotnet/aspnetcore

Describe the bug

The server-side Blazor application doesn't start when the authentication is set to Windows Authentication in Google Chrome. Creating an application without authentication works fine.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new Blazor server-side application with Windows Authentication
  2. Start the application in IIS Express and open the application in Chrome.
  3. You'll see the pre-rendered page and in the top-right the username of the current Windows user is shown: Hello, DOMAIN\user!.
  4. Go to the page 'Counter'.
  5. When you try to click the button 'Click me', nothing happens.

Additional context

I've tested in the following browsers with Windows Authentication enabled:

| Browser | Is working? |
|-------------------|-------------|
| Chrome | No |
| Internet Explorer | Yes1 |
| Edge | Yes |
| FireFox | Yes |

1 IE only works with https://github.com/Daddoon/Blazor.Polyfill added.


Some points that I found that might be handy:

  1. By removing the line Html.RenderStaticComponentAsync<App>() in _Host.cshtml you'll notice that the page is white. The content that you see is pre-rendered.
  2. Chrome and Internet Explorer does authenticate automatically but FireFox and Edge does not
    (I need to provide my username and password).
  3. In Chrome, the WebSocket connection is established:
    image
    but no data was sent:
    image
  4. In FireFox everything works fine:
    image

> dotnet --info:
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview8-013656
 Commit:    8bf06ffc8d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\

Host (useful for support):
  Version: 3.0.0-preview8-28405-07

> Visual Studio:
Microsoft Visual Studio Enterprise 2019 Preview
Version 16.3.0 Preview 2.0

> IIS
IIS Express 10.0.18362.1

> Google Chrome
Version 76.0.3809.132 (Official Build) (64-bit)
area-blazor investigate

Most helpful comment

Reported in the Chromium bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=998693

All 8 comments

Thanks for contacting us, @GerardSmit.
We are unable to reproduce this issue, which indicates something is probably wrong on your end. You may need to look for errors in your browser dev console.

I've checked the console but there is no error:

image

I cleared my cookies, site cache, local/session storage with no success. I tried the application in Incognito (so extensions wont load) but it still doesn't work. However when I open Chrome in the Guest mode the application works fine:

image

It seems there is something wrong with my account in Chrome, which is weird because it shouldn't affect the application at all.

That being said the issue isn't coming from Blazor. I thought I tried everything before creating this issue but I never expected it to be something like this. I'm sorry for the false report.

Alright, found the problem.

After resetting Chrome (removing all settings and extensions) the application works. After re-enabling the extensions the application stopped working. It seems the extension "Tampermonkey" is causing problems, even in Incognito while it doesn't have access to Incognito.

Reported in the Chromium bug tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=998693

Thanks for information, @GerardSmit. Good to know. Hope this will help others in community too.

THANK YOU THANK YOU THANK YOU!!!!!!! I thought I was going nuts. Same issue but different extension. Didn't even consider the extensions being the issue until seeing your posts, especially since its happening in Incognito for me, also! I had to switch over to Edge just to test this last month or so.

While I understand that this failure is a chrome issue and not a blazor issue, the user experience when this occurs is very confusing. Would it be possible for Blazor to put up a warning when the SignalR connection to the server can't be established or is taking a really long time to establish, similar to the way that it displays an overlay if the connection is lost?

By the way, there are a few chrome extensions that cause this issue including, Requestly and Tampermonkey.

As a workaround for now, it is possible to change the RenderMode to Server to switch off pre-rendering and add something like the following to _Host.cshtml so that at least a user experiencing this issue gets a sensible error message rather than an application that doesn't respond to anything:

<div id="loading" style="position:absolute; visibility: hidden">
    <p>Error connecting to server....</p>
    <p>NOTE: If you are using Chrome and are seeing this then try a different browser or disable your plugins.</p>
</div>
<script type="text/javascript">
function showLoadingDiv() {
  document.getElementById("loading").style.visibility = "visible";
}
setTimeout("showLoadingDiv()", 10000); 
</script>

<app>
    @(await Html.RenderComponentAsync<App>(RenderMode.Server))
</app>

Information for the participants: This issue has been fixed in Chrome 79, which is the next version of Chrome and will be released tomorrow (10 December).

Was this page helpful?
0 / 5 - 0 ratings