500 error for long url iis7

2019-07-17 01:40发布

I was getting 404 errors for some long URLs on a website I'm developing. After a bit of digging I discovered that this occurs when the length of certain aspects of the URL exceed configurable limits in IIS7. In this case the maxQueryString attribute of the requestLimits property needed to be increased in the web.config

<system.webServer>
<security>
  <requestFiltering>
    <requestLimits maxQueryString="4096" maxAllowedContentLength="4096" maxUrl="8192" >
    </requestLimits>
  </requestFiltering>
</security>

This fixed the problem instantly on my development server but on the remote server I now get:

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

And that's all the information it gives me.

4条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-17 02:09

Change your Flash to send the data as POST, so it won't be appended to the URL. Here's some sample code. Also, you may need to change the server side to look for the data as POST instead of GET.

查看更多
爷的心禁止访问
3楼-- · 2019-07-17 02:13

You should not use such long URLs. Among other reasons, at least one of the common toolbars (Bing, Yahoo, Google) will break them, producing just such errors. Users will blame you.

I know this because one of my users was having just such a problem with a legacy app. When I removed the toolbars (she had all three installed!), the problem went away.

查看更多
男人必须洒脱
4楼-- · 2019-07-17 02:23

A GET request is only limited by a browser's limit on the length of the URL string. In IE it is 2,083 characters, minus the number of characters in the actual path. Other browsers do not have a clearly defined limit on the length of the URL string. These articles might be helpful to you.

http://www.boutell.com/newfaq/misc/urllength.html

http://support.microsoft.com/kb/q208427

RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify any requirement for URL length, so browsers are free to stipulate what they deem fit.

therefore you should use POST instead of GET if it's fits within your requirements

查看更多
Animai°情兽
5楼-- · 2019-07-17 02:31

Are you sure your hoster/production-server is running Windows Server 2008 (or 2008 R2)? The settings you are describing above are only valid for IIS 7+.

查看更多
登录 后发表回答