Closed daltinkurt closed 3 years ago
I added a sample page:
@viewModel DentistApp.ViewModels.TestViewModel, DentistApp
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<dot:Button Text="Click me" Click="{command: ClickMe()}"></dot:Button>
{{value: TestString}}
</body>
</html>
public class TestViewModel : DotvvmViewModelBase
{
public string TestString { get; set; }
public void ClickMe()
{
TestString = DateTime.Now.ToLongTimeString();
}
}
and the error occurs again:
Wow, I've never seen this behavior.
Can you look into Startup.cs
? What middlewares are registered before calling app.UseDotVVM
. It seems like some middleware eats the request body.
Here is the startup.cs Configure method: i tried many settings but i couldn't solve the error
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
//app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseStaticFiles(new StaticFileOptions()
{
...
});
app.UseCookiePolicy();
app.UseRouting();
var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
app.UseRequestLocalization(locOptions.Value);
// global cors policy
app.UseCors(x => x
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(origin => true) // allow any origin
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowCredentials()); // allow credentials
app.UseAuthentication();
app.UseAuthorization();
app.UseSession();
// app.UseResponseCompression();
// app.UseResponseCaching();
// use DotVVM
var dotvvmConfiguration = app.UseDotVVM<DotvvmStartup>(env.ContentRootPath);
dotvvmConfiguration.AssertConfigurationIsValid();
// use static files
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Api}/{action=Index}/{id?}");
});
Thanks, I'll try to make a repro project to see what's wrong.
@daltinkurt Hello, I haven't been able to reproduce the exception with the configuration above. However, once I put
app.Use(async (context, next) => {
context.Request.Body = new MemoryStream();
await next.Invoke();
});
before the DotVVM middleware I got the exact same exception. Please make sure none of the middlewares before DotVVM are doing anything fishy with the request.
@Mylan719 IIRC you said that you encountered this issue somewhere else as well. Can you elaborate please?
@cafour I had a similar problem, but we have fixed it. At this moment, it seems like this issue can't be reproduced with more detail. So I close it for now. If there are more details on this feel free to reopen it.
I upgraded to net5 and also latest dotvvm nuget package. I get this error after click the button.
Is this error releated to me or you? :)
stack trace:
DotVVM.AspNetCore 3.0.4 .NET 5.0.6
request header:
request payload:
{"currentPath":[],"command":"wpVI3fhuLTmVo63B","controlUniqueId":"","validationTargetPath":"dotvvm.viewModelObservables['root']","renderedResources":["knockout","dotvvm.polyfill.bundle","dotvvm.internal","dotvvm","dotvvm.debug"],"commandArgs":[],"knownTypeMetadata":["OrbZWyITvFhVuUA/yWHUOK5MPxQ=","5Rv8K4eLysbaJCtquQklgisMbV0=","rUxZ96wcbmlstFoHtOe8p0/1kw0=","3aRh7hTve75OuaowpI7QQrSgDIU="],"viewModel":{"$type":"OrbZWyITvFhVuUA/yWHUOK5MPxQ=","Eposta":"daltinkurt@hotmail.com","Hata":null,"Hatirla":false,"HtmlDil":"tr","Sifre":"1111","$csrfToken":"CfDJ8NRUNnxO81FMkt9W1l3UPzTAdBieRlTWbYMMb3sZwJEOi7ow2AszBZBPzkHQZte+EemQIeDLfZwqycZx1W5Ix/SJAoQgjX3mr5IBxPU+LW7OQlR37cOTcnhKfrK6EcTcN249wkzF3kBS5KRRec3N81uK8+JYv7qn+ViS+hB7u3YL"}}
and this is the error message on the console: