Closed hasmMarques closed 4 years ago
Same Problem here...
Thanks for contacting us @hasmMarques.
@vijayrkn should this move to the scaffolding
repo?
@HaoK - do you want to handle identity content issues in aspnet/identity or aspnet/scaffolding?
Ideally it should be based on which repo the fix is going into, if it requires changes in both the framework UI library as well as the scaffolding, it should be in AspNetCore, if its only changes required in the scaffolding/templates, then it should go in the scaffolding repo.
Either way if its assigned to me I will see it
I have a similar issue when I tried to scaffold through dotnet CLI using VS Code. I wasn't able to start the project with the scaffolded items. I wanted to use them to make a custom login and register forms with Blazor (Razor) components without success. I tried to start a new project without identity and manually to configure it, but with server-side I awlays ended with the error below. It happens when I hit _signInManager.SignInAsync in the debugger. Similar if not the same happens with the .PasswordSignInAsync method.
Microsoft.AspNetCore.Components.Server.ComponentHub: Warning: Unhandled exception in circuit CfDJ8Hh6jTIGeEREjBREH96LvZgUyKAbXakcJAYLhWVqy470uzfvlak5-mijm83-dd8INRiOUBUTpC_s8bfFOqj_TRO5kxUTfjwwJ_huMKg5n1Colx8a7I9ZxRiigfJ_tsDWyOglxjwcw_2QYtkz4ZI1BVuNrRk5QO-VzwSYKLuQU4lI
System.InvalidOperationException: OnStarting cannot be set because the response has already started.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowResponseAlreadyStartedException(String value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.OnStarting(Func`2 callback, Object state)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.Microsoft.AspNetCore.Http.Features.IHttpResponseFeature.OnStarting(Func`2 callback, Object state)
at Microsoft.AspNetCore.Http.DefaultHttpResponse.OnStarting(Func`2 callback, Object state)
at Microsoft.AspNetCore.Http.HttpResponse.OnStarting(Func`1 callback)
at Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.InitializeHandlerAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.InitializeAsync(AuthenticationScheme scheme, HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, String authenticationScheme)
at Microsoft.AspNetCore.Authentication.AuthenticationService.SignInAsync(HttpContext context, String scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
at Microsoft.AspNetCore.Identity.SignInManager`1.SignInWithClaimsAsync(TUser user, AuthenticationProperties authenticationProperties, IEnumerable`1 additionalClaims)
at Microsoft.AspNetCore.Identity.SignInManager`1.SignInOrTwoFactorAsync(TUser user, Boolean isPersistent, String loginProvider, Boolean bypassTwoFactor)
at Microsoft.AspNetCore.Identity.SignInManager`1.PasswordSignInAsync(TUser user, String password, Boolean isPersistent, Boolean lockoutOnFailure)
at Microsoft.AspNetCore.Identity.SignInManager`1.PasswordSignInAsync(String userName, String password, Boolean isPersistent, Boolean lockoutOnFailure)
at Experimental.Pages.Security.Login.HandleLogin() in /Users/codingaccountant/CodingAccountant/Experimental/Pages/Security/Login.razor:line 44
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.Rendering.Renderer.GetErrorHandledTask(Task taskToHandle)
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint '/_blazor'
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 28923.267200000002ms 101
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 28923.267200000002ms 101
Ran into exactly the same issue as @hasmMarques.
@vijayrkn, @HaoK what's the latest on this? Can you provide an ETA for resolution on this?
I'm OOF this week, I can take a look and provide an ETA on monday
@vijayrkn any ideas on what's going on here? The scaffold operation does not complete successfully due to the Startup error above, the App itself compiles fine, so something is broken on the scaffolding operation I guess?
Note: its not necessary to override all files either, even just overriding a single UI file will result in this error, so I think its something wrt to compilation of the app during the scaffolding process
If it is an issue with scaffolding operation, you can remove the preview9 milestone. This would be fix on the VS side then.
Similar issue,
I have posted a work-around for this problem on SO recently.
The steps, based on a Preview8 server-side project with "Individual user accounts" :
// endpoints.MapBlazorHub<App>(selector: "app");
endpoints.MapBlazorHub()
line againPages/_ViewStart.cshtml
Pages/Shared/_Layout.cshtml
, the first line is missing @using
Pages/Shared/_Loginpartial.cshtml
, the second line is missing @inject
That works! Thanks!
Hi Henk,
Thanks for the input. its works fine however there is a bit confusion. there are two _viewStart.cshtml which one should i delete. i tried both , but both time i am getting two headers. as i attached with this thread.
Looking for your support.
You should not delete the one under \Areas\Identity, just the one under the top level \Pages.
So it should have worked, make sure you have a Build with no errors, flush your browser (Ctrl+F5) etc.
Just to update this for Preview9 and RC1, only 2 steps remain:
after the add-scaffolding,
dotnet 3.0.100-preview8-013656