小编tam*_*nov的帖子

如何阻止IIS解码URL

我使用的是Windows 7,IIS 7.5,.NET 4.5.
(对于Windows 8,IIS 8.5,.NET 4.5,这是有效的).

使用URL执行GET请求:

http://my.host/api1/MyEntity('%2311282')
Run Code Online (Sandbox Code Playgroud)

问题是当它到达服务器端代码时,%23 char已经被解码为'#'而Uri对象认为它是一个片段char.Win8机器接收到char%23未触及的URL.

试图:
1)使用此配置设置

<httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" />
Run Code Online (Sandbox Code Playgroud)

2)在URL的末尾添加"/"

http://my.host/api1/MyEntity('%2311282')/
Run Code Online (Sandbox Code Playgroud)

3)卸载url rewrite 2模块 - 并重新安装.还尝试在web.config中为模块注释重写部分.

为什么我要复制Windows 8的行为 - 不解码URL.有任何想法吗?

asp.net iis url url-routing

5
推荐指数
1
解决办法
4399
查看次数

Java客户端无法从wcf rest服务中读取大的响应

我试图在Android 2.1上使用Java客户端使用其余的WCF服务.它适用于小响应.当我试图通过获得1000+ char响应reader.read(缓冲区)无法读取所有字符时进一步推动.这导致脚本的最后一行返回:JsonException未终止的字符串,字符为8193"{plate,...

我的android设备开始在模拟器android明星得到它之前得到这个错误(字符1194而不是8193).谁知道怎么得到完整的消息?

客户代码:

HttpGet request = new HttpGet(SERVICE_URI + "/GetPlates");
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
char[] buffer = new char[(int)responseEntity.getContentLength()];
InputStream stream = responseEntity.getContent();
InputStreamReader reader = new InputStreamReader(stream);
reader.read(buffer);
stream.close();         
JSONArray plates = new JSONArray(new String(buffer));
Run Code Online (Sandbox Code Playgroud)

服务器配置:

<webHttpBinding>
    <binding name="big_webHttpBinding" maxReceivedMessageSize="4097152" maxBufferSize="4097152" maxBufferPoolSize="4097152">
      <readerQuotas maxStringContentLength="4097152" maxArrayLength="4097152" maxBytesPerRead="4097152" maxNameTableCharCount="4097152" maxDepth="4097152"/>
    </binding>
  </webHttpBinding>
Run Code Online (Sandbox Code Playgroud)

java wcf android httpwebrequest

1
推荐指数
1
解决办法
1186
查看次数

标签 统计

android ×1

asp.net ×1

httpwebrequest ×1

iis ×1

java ×1

url ×1

url-routing ×1

wcf ×1