本文介绍了IIS 6中的查询字符串不允许周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署了一个asp.net网站与WCF休息服务的虚拟目录。它接受纬度/经度的查询字符串。 IIS显然不允许包含一个查询字符串。。我发现的话题numerious职位,但似乎无法来解决问题。

我试图让这两个父网站和虚拟目录的父路径:

我已经尝试过的httpRuntime设置relaxedUrlToFileSystemMapping =真

目前我已经启用了这两个父路径和我的httpRuntime设置是:

 <的httpRuntime requestValidationMode =2.0requestPathInvalidCharacters =axedUrlToFileSystemMapping =真/>


解决方案

我注意到,您正在使用的URL有/,而不是?这会导致元件作为路径而不是一个查询字符串被处理

如果这是有意和你正在使用.NET 4.0,你可以尝试使用的下配置:

 <&URI GT;
    < schemeSettings>
        <添加名称=HTTPgenericUriParserOptions =DontUnescapePathDotsAndSlashes/>
    < / schemeSettings>
< / URI>

请参阅的有效值。

如果这是不打算更新您​​的模板的?标志,你应该确定:

[WebGet(UriTemplate =用户名= {用户名}&放大器;纬度= {纬度}&安培; LNG = {LNG})]

I have deployed an asp.net site with a wcf rest service to a virtual directory. It accepts lat/lon in the querystring. IIS is apparently not allowing querystrings that contain a '.'. I have found numerious posts on the topic, but cannot seem to resolve the issue.

I have tried enabling parent paths on both the parent website and the virtual directory:http://support.microsoft.com/kb/332117

I have already tried the httpRuntime setting for relaxedUrlToFileSystemMapping="true"http://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx

currently I have both parent paths enabled and my httpRuntime settings are:

<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" relaxedUrlToFileSystemMapping="true" />
解决方案

I noticed that the Urls you were using have a / rather than a ? which causes the elements to be treated as a path rather than a query string.

If that was intended and you are using .NET 4.0, you can try using the <schemeSettings> Element (Uri Settings) under configuration:

<uri>
    <schemeSettings>
        <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes" />
    </schemeSettings>
</uri>

See GenericUriParserOptions Enumeration for the valid values.

If that was not intended update your template to use the ? mark and you should be ok:

[WebGet(UriTemplate = "?username={username}&lat={lat}&lng={lng}")]

这篇关于IIS 6中的查询字符串不允许周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 07:06