我正在开发一个测试项目来实现wcf回调,当我在本地调试时,我的代码工作,然后回调实际上工作,但是当我连接到实时服务器时,它只会冻结任何方法。
我尝试了所有Conncurency模式,我尝试设置超时但都失败了
public interface IWorkplaySupportServiceCallBack
{
[OperationContract(IsOneWay = true)]
void HandleData(byte[] buffer);
[OperationContract(IsOneWay = true)]
void SessionCreated();
}
[ServiceContract(CallbackContract = typeof(IWorkplaySupportServiceCallBack))]
public interface IWorkplaySupportService
{
[OperationContract(IsOneWay = true)]
void CreateSession(string sessionId);
}
[CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant, UseSynchronizationContext = false)]
public class WorkplaySupportService : IWorkplaySupportService
{
public void CreateSession(string sessionId)
{
var callback = OperationContext.Current.GetCallbackChannel<IWorkplaySupportServiceCallBack>();
callback.SessionCreated();
}
}
这是我的配置
<!-- WCF START-->
<bindings>
<wsDualHttpBinding>
<binding name="basicHttpFor2MBMessage" maxBufferPoolSize="2097152"
maxReceivedMessageSize="2097152" messageEncoding="Mtom">
<readerQuotas maxArrayLength="2097000" />
<security mode="None">
<message clientCredentialType="None" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="wsDualHttpBinding.SampleServiceBehavior"
name="Workflowms.Web.webservices.support.WorkplaySupportService">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="basicHttpFor2MBMessage"
contract="Workflowms.Web.webservices.support.IWorkplaySupportService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="wsDualHttpBinding.SampleServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
通过使用Trace事件我弄清楚它为什么没有响应,但我不知道如何解决这个问题,客户端连接是我的笔记本电脑而服务器不在同一个网络上(通过互联网连接),我通过Internet添加了wcf引用,但是当我运行它时,我没有得到连接,在服务器上跟踪事件我得到以下异常 在http://donald-pc/Temporary_Listen_Addresses/f9dbbcde-f968-48f1-bc48-e1e12dd13e32/6ca1305c-95e4-4248-a5f3-cbb594ea8a26没有可以接受该消息的端点监听。这通常是由错误的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。
答案 0 :(得分:0)
我设法通过更改
让它无故障地运行l.user_id
要
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="basicHttpFor2MBMessage" contract="Workflowms.Web.webservices.support.IWorkplaySupportService"> </endpoint>
添加
<endpoint address="" binding="netHttpBinding" bindingConfiguration="netHttpBinding" contract="Workflowms.Web.webservices.support.IWorkplaySupportService">
现在我的回调在Intranet和Internet上工作