繁体   English   中英

WCF服务:仅一项功能的错误请求

[英]WCF Service: Bad Request at only one function

我已经编程了一个WCF Web服务,该服务可以在我的IDE中正常运行。 现在,我已经建立了一个设置并将其安装在我们的Web服务器上,由于配置了HTTP到HTTPS重定向,因此出现了一些问题。 在对web.config进行一些更改之后,我使我的服务处于运行状态,并且调用函数也正常工作。 例如,/ Customers / GetAll返回以JSON序列化的客户对象列表,对于/ Customer / name = XYZ来说,该列表相同,后者根据客户的名称返回对象。

现在我的问题(;)为VB.Net感到抱歉):

   <OperationContract()> _
   <WebGet(ResponseFormat:=WebMessageFormat.Json, UriTemplate:="User/Get/value={pValue}&identifier={pSearchIdentifier}")> _
   Function GetUser(ByVal pValue As String, pSearchIdentifier As String) As LMEngine.User

仅返回“错误请求”,而不会返回其他任何内容。 我还向该函数添加了一些日志记录行。 如果我在本地运行该服务,我的所有日​​志行都会写入我的文件中-在我们的Web服务器上,什么也没有发生。

我想这是我的web.config中的内容,但我真的不知道要更改什么。 您可以检查配置是否有任何错误?

  <system.serviceModel>
      <services>
         <service behaviorConfiguration="LogMeWebServiceRest.Service1Behavior" name="LogMeWebServiceRest.LogMe">
            <!--WCF Test Client-->
            <!--<endpoint address="" binding="wsHttpBinding" contract="LogMeWebServiceRest.ILogMe">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
            <!-- For testing in Browser -->
            <endpoint address="" binding="webHttpBinding" contract="LogMeWebServiceRest.ILogMe" bindingConfiguration="LogMeEndpointBinding" behaviorConfiguration="webBehavior" />
         </service>
      </services>
      <bindings>
         <webHttpBinding>
            <binding name="LogMeEndpointBinding">
               <security mode="Transport">
               </security>
            </binding>
         </webHttpBinding>
      </bindings>
      <behaviors>
         <serviceBehaviors>
            <behavior name="LogMeWebServiceRest.Service1Behavior">
               <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
               <serviceMetadata httpsGetEnabled="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>
         <endpointBehaviors>
            <behavior name="webBehavior">
               <webHttp/>
            </behavior>
         </endpointBehaviors>
      </behaviors>
   </system.serviceModel>

谢谢!

这可能与网址有关。 在Web服务器中,可能是正在调用不同的方法,这就是为什么它未记录任何内容。 仅用于故障排除,请尝试将uritemplate更改为UriTemplate:=“ User5 / Get5 / ..”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM