.net WCF服务:只有一个功能的请求错误
我已经编写了一个WCF web服务,它在我的IDE中运行良好。现在我已经建立了一个安装程序,并将其安装在我们的web服务器上,由于配置了HTTP到HTTPS重定向,所以出现了一些问题。在我的web.config中做了一些更改之后,我的服务处于运行状态,调用函数也可以正常工作。例如,/Customers/GetAll返回一个以JSON序列化的客户对象列表,对于/customer/name=XYZ来说,它与根据客户的名称返回对象是一样的 现在我的问题(;)对不起VB.Net):.net WCF服务:只有一个功能的请求错误,.net,wcf,rest,service,.net,Wcf,Rest,Service,我已经编写了一个WCF web服务,它在我的IDE中运行良好。现在我已经建立了一个安装程序,并将其安装在我们的web服务器上,由于配置了HTTP到HTTPS重定向,所以出现了一些问题。在我的web.config中做了一些更改之后,我的服务处于运行状态,调用函数也可以正常工作。例如,/Customers/GetAll返回一个以JSON序列化的客户对象列表,对于/customer/name=XYZ来说,它与根据客户的名称返回对象是一样的 现在我的问题(;)对不起VB.Net): _ _ 函数GetU
_
_
函数GetUser(ByVal pValue作为字符串,pSearchIdentifier作为字符串)作为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>
谢谢大家! 这可能与url有关。在webserver中,可能它正在调用不同的方法,这就是为什么它不记录任何内容的原因。
仅为了排除故障,请尝试将uritemplate更改为类似uritemplate:=“User5/Get5/。”您如何调用GetUser?感谢您的回复!https://server2013c/LogMe/LogMe.svc/User/Get/value=Andy&identifier=Name-它在本地主机上运行正常,但在我们的服务器上运行不正常。在服务器上部署需要稍有不同的配置:)上面的配置是来自我的服务器的配置。不同的配置意味着什么?我必须改变什么?谢谢搞什么鬼。我将其重命名为User5/Get5/并替换了参数(参见下面的代码)。那时候工作很好。现在它也可以在没有5的情况下工作<代码>\。非常感谢你!
<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>