0

我有一个如下的网络服务

   <OperationContract()>
   <Web.WebGet(UriTemplate:="/GetData?strErrMsg={strErrMsg}&chrErrFlg={chrErrFlg}", ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Wrapped)> _
    Function GetData(ByRef strErrMsg As System.Collections.Generic.List(Of String), ByRef chrErrFlg As String) As String

我正在尝试将其获取为

http://BedTypeMasterService.svc/GetData?strErrMsg= "ff"&chrErrFlg="dd"

但它给出了以下错误

合约“iBedTypeMaster”中的操作“GetData”有一个名为“strErrMsg”的查询变量,类型为“System.Collections.Generic.List 1[System.String]', but type 'System.Collections.Generic.List1[System.String]”,不能由“QueryStringConverter”转换。UriTemplate 查询值的变量必须具有可由“QueryStringConverter”转换的类型。

请帮我解决这个问题

根据提供的链接,我尝试这样

      <behaviors>

  <endpointBehaviors>
    <behavior name="webHttpBehavior">
      <customWebHttp/>
    </behavior>


  </endpointBehaviors>

 <extensions>
  <behaviorExtensions>
    <add name="customWebHttp" type="WcfServices.BedTypeMaster.bclsBedTypeMaster, WcfServices" />
  </behaviorExtensions>
</extensions>


      <service behaviorConfiguration="ServiceBehavior" name="WcfServices.BedTypeMaster.bclsBedTypeMaster">
    <endpoint address="" binding="webHttpBinding"
              bindingConfiguration="webHttpBindingWithJsonP" contract="WcfServices.BedTypeMaster.iBedTypeMaster"
              behaviorConfiguration="webHttpBehavior">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" />
  </service>
4

0 回答 0