Bad Request - Invalid URL web api

前端 未结 1 601
[愿得一人]
[愿得一人] 2021-01-19 19:48

I am working on a web-api and I have set the web config file to accept 6144 as the max length of the url as below

&         


        
相关标签:
1条回答
  • 2021-01-19 20:17

    I've had the same issue when self hosting web-api. I would guess the limit you are hitting is the UrlSegmentMaxLength default from Http.sys.

    To fix this you need to add a new registry DWORD under

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters

    enter image description here

    called UrlSegmentMaxLength and give this the value you desire:

    UrlSegmentMaxLength 260 0 - 32,766 chars Maximum number of characters in a URL path segment (the area between the slashes in the URL). If zero, it is the length that is bounded by the maximum value of a ULONG.

    References:
    https://serverfault.com/questions/66410/iis-6-on-x64-and-long-urls
    http://support.microsoft.com/kb/820129

    0 讨论(0)
提交回复
热议问题