Open Closed

Html Error 400 after deploying to IIS at POST, PUT, DELETE -> normal working in Visual Studio #8986


User avatar
0
puchner_it42 created

We have big troubles with deploying our system. (Single Layser Application, MVC )

All is working fine at the development with Visual Studio. After deploying it to IIS all GET requests are working, but if we do an POST, PUT, DELETE we get an Error 400.

We are looking to fix the errors since days, we cannot find any solution in the forum.

Please help to fix the issue

  • Database System: EF Core (SQL Server)

  • Steps to reproduce the issue: After deploying to IIS no POST, PUT, DELETE is working. GET is working


13 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello,

    Have you checked our document about deployment to ISS?
    If not, you can access it here.

    You can also find tickets with the same problem as you below:

  • User Avatar
    0
    puchner_it42 created

    Hello,

    Have you checked our document about deployment to ISS?
    If not, you can access it here.

    You can also find tickets with the same problem as you below:

    Yes, i have tried all this. can you help me over remote desktop?

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Yes, i have tried all this. can you help me over remote desktop?

    Unfortunately, we do not have such a service.

    In the meantime, a colleague of our team said that this could also be caused by the hosting company. Some hosting companies do not open requests other than GET requests by default. Which hosting company do you use?

    Note: Deployment is not a feature directly provided by ABP, but I still tried to help as much as we can.

  • User Avatar
    0
    puchner_it42 created

    Yes, i have tried all this. can you help me over remote desktop?

    Unfortunately, we do not have such a service.

    In the meantime, a colleague of our team said that this could also be caused by the hosting company. Some hosting companies do not open requests other than GET requests by default. Which hosting company do you use?

    Note: Deployment is not a feature directly provided by ABP, but I still tried to help as much as we can.

    The IIS is running on my local machine. The App is working if i will start it from Visual Studio, after deployment to IIS only the GET requests are working. The other one´s are not working.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Any chance you can send me the logs? Let's examine in detail.

  • User Avatar
    0
    puchner_it42 created

    Any chance you can send me the logs? Let's examine in detail.

    https://it42io-my.sharepoint.com/:u:/g/personal/puchner_it42_io/EZFW9oh9cudEvlVG922tCLgBLNHXouGjlTZ1EMq0VP6GOg?e=BBaeHf

    e.g. Line 1699 i get this 400 error. The page is a normal from abp generated CRUD page.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    By the way, have you tried disabling the WebDAV feature on Windows Server or Desktop machines?

    https://dev.to/devvsamjuel/webdav-put-and-delete-http-verbs-remove-webdav-module-on-iis-3l1g

  • User Avatar
    0
    puchner_it42 created

    By the way, have you tried disabling the WebDAV feature on Windows Server or Desktop machines?

    https://dev.to/devvsamjuel/webdav-put-and-delete-http-verbs-remove-webdav-module-on-iis-3l1g

    Yes, i did

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    My teammate who is more experienced than me about ISS will try to help you.

  • User Avatar
    0
    puchner_it42 created

    It is a problem with the antiforgery token.

    [17:08:47 INF] Notification is sent on same window time.
    [17:08:54 INF] Request starting HTTP/1.1 POST http://localhost/InternationaleKennzeichen/CreateModal - application/x-www-form-urlencoded; charset=UTF-8 260
    [17:08:54 INF] Executing endpoint '/InternationaleKennzeichen/CreateModal'
    [17:08:54 INF] Route matched with {page = "/InternationaleKennzeichen/CreateModal", action = "", controller = "", area = ""}. Executing page /InternationaleKennzeichen/CreateModal
    [17:08:54 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy
    [17:08:54 INF] Antiforgery token validation failed. The antiforgery token could not be decrypted.
    Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted.
    ---> System.Security.Cryptography.CryptographicException: The key {9b83a679-a168-452b-8719-d75cefa55147} was not found in the key ring. For more information go to https://aka.ms/aspnet/dataprotectionwarning
    at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
    at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
    at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
    --- End of inner exception stack trace ---
    at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
    at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.DeserializeTokens(HttpContext httpContext, AntiforgeryTokenSet antiforgeryTokenSet, AntiforgeryToken& cookieToken, AntiforgeryToken& requestToken)
    at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateTokens(HttpContext httpContext, AntiforgeryTokenSet antiforgeryTokenSet)
    at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext)
    at Microsoft.AspNetCo

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    You can also find tickets with the same problem as you below:

    https://abp.io/support/questions/7937/POST-PUT-and-DELETE-requests-return-a-Bad-Request-400-error

    In a ticket I forwarded to you before, it was stated that the problem may be CRSF. However, since you said that you checked this and that this was not the problem, I did not think about it. But if this is the problem, could you try the following configuration and let me know if it works for you?

    Configure<AbpAntiForgeryOptions>(options =>
    {
        options.TokenCookie.SecurePolicy = CookieSecurePolicy.None;
    });
    
    

    Because you are using HTTP, the XSRF-TOKEN cookie required HTTPS. If you want to use HTTP, you have to set SecurePolicy to CookieSecurePolicy.None:

    3a09a7dc98150a3790f167b881ed14f6.png

  • User Avatar
    0
    puchner_it42 created

    I got the same error. For now i will disable it.

    Configure<AbpAntiForgeryOptions>(options =>
    {
    options.AutoValidate = false;
    });

    I know that is not the solution but i will enable it later.

    I always got the exception "antiforgery the key was not found in the key ring". How can i handle the antiforgery key in abp?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    POST http://localhost/

    As Berkansasmaz said, The problem is related to HTTP.

    You can use the solution from https://abp.io/community/articles/patch-for-chrome-login-issue-identityserver4-samesite-cookie-problem-weypwp3n

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 18, 2025, 10:42