首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wcf服务maxUrlLength maxQueryStringLength maxRequestLength

wcf服务maxUrlLength maxQueryStringLength maxRequestLength
EN

Stack Overflow用户
提问于 2012-09-20 00:30:05
回答 1查看 2K关注 0票数 0

您好,我有一个WCF服务,网址不工作,如果我调用一个超过260个字符的变量路径,谁有什么建议吗?

代码语言:javascript
复制
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxUrlLength="32766" maxQueryStringLength="2097151" maxRequestLength="2097151" requestValidationMode="2.0" relaxedUrlToFileSystemMapping="true" />
<customErrors mode="Off"/>
 </system.web>
 <system.serviceModel>
<bindings>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
    <service name="DToolsSynchronizationService.SyncService">
    <endpoint kind="webHttpEndpoint"
    contract="DToolsSynchronizationService.ISyncService" />
  </service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

我有IIS 7,它在64位windows server 2008中运行

我正在打开HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters

我右键单击参数,选择新的dword 32位值,我将其命名为

MaxFieldLength (我选择十六进制)输入fffe,它是0x0000fffe (65534)

MaxRequestBytes (我选择十六进制)输入1000000,它是0x0000fffe (16777216)

UrlSegmentMaxLength (我选择十六进制)输入fffe,它是0x001fffff (2097151)

就像在图片https://dl.dropbox.com/u/541519/fb/reg.png中一样

我重新启动服务器,但仍然只能看到260个字符。我做错了什么?

我还打开了iis来设置请求过滤为正确的值(最大url长度的查询字符串->enable设置为2097151,最大查询字符串)

EN

回答 1

Stack Overflow用户

发布于 2012-09-20 00:35:50

您可能可以使用自定义webHttpBinding来解决此问题。

代码语言:javascript
复制
<bindings>
    <webHttpBinding>
        <binding name="longbinding" maxUrlLength="32766 />
    </webHttpBinding>
</bindings>

然后将其用于您的端点

代码语言:javascript
复制
<endpoint kind="webHttpEndpoint"
    contract="DToolsSynchronizationService.ISyncService" 
    bindingConfiguration="longbinding"/>

您可能需要进一步配置绑定,但这应该是一个开始。

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12498980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档