更新:
我一直试图打开WCF跟踪,但仍然没有成功......以下是我最新的更新.
我是否需要获得写入以下位置的许可?
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "@\\myservername\folder1\traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
Run Code Online (Sandbox Code Playgroud)
我正在使用.NET Framework 3.5.
为调试目的打开WCF跟踪的逐步说明是什么?
我有以下场景,我正在尝试测试:
当我从客户端到服务端点进行Web服务调用时,我得到以下异常:
{"与动作'的消息HTTP:// IMyService/CreateContainer ’不能在接收器处进行处理,由于在EndpointDispatcher一个ContractFilter不匹配,这可能是因为无论是合同不匹配(发送者和接收者之间不匹配的操作)或一发送方和接收方之间的绑定/安全性不匹配.检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无)."}
我开始使用MS Service Trace Viewer,但不确定在哪里查看.在查看客户端和端点中的类时,它们看起来完全相同.
如何开始调试此问题?
导致此异常的可能原因是什么?
我有一个客户端控制台应用程序与WCF服务通信,我收到以下错误:"服务器没有提供有意义的答复;这可能是由合同不匹配,过早的会话关闭或内部服务器错误引起的."
我认为这是因为合同不匹配但我无法弄清楚原因.该服务本身运行良好,两个部分一起工作,直到我添加了模拟代码.
任何人都可以看到有什么问题?
这是客户端,全部用代码完成:
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
EndpointAddress endPoint = new EndpointAddress(new Uri("net.tcp://serverName:9990/TestService1"));
ChannelFactory<IService1> channel = new ChannelFactory<IService1>(binding, endPoint);
channel.Credentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
IService1 service = channel.CreateChannel();
Run Code Online (Sandbox Code Playgroud)
这是WCF服务的配置文件:
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="MyBinding">
<security mode="Message">
<transport clientCredentialType="Windows"/>
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WCFTest.ConsoleHost2.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="WCFTest.ConsoleHost2.Service1Behavior"
name="WCFTest.ConsoleHost2.Service1">
<endpoint address="" binding="wsHttpBinding" contract="WCFTest.ConsoleHost2.IService1">
<identity>
<dns value="" /> …Run Code Online (Sandbox Code Playgroud) 我有一个在Visual Studio中运行的简单Web服务.如果我尝试查看元数据,则会丢失有关操作的信息,因此svcutil会生成客户端代码,而无需任何方法.我的设置有什么问题吗?
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FCRPublishSOAP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Test.Publish.FCRPublish" behaviorConfiguration="SimpleServiceBehavior">
<endpoint address="FCRPublish" behaviorConfiguration="" binding="basicHttpBinding" bindingConfiguration="FCRPublishSOAP" contract="IFCRPublish"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
</behavior>
</serviceBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)
接口:
[System.ServiceModel.ServiceContractAttribute(Namespace="http://Test/Publish", ConfigurationName="IFCRPublish")]
public interface IFCRPublish
{
// CODEGEN: Generating message contract …Run Code Online (Sandbox Code Playgroud)