[Mono-osx] Mono - WCF

sheen sheenchandy at verifaya.com
Tue Oct 16 11:31:59 UTC 2012


Hi,

I have an issue in calling WCF Services.
I will explain issue using below example

WCF Interface :

[ServiceContract]
public interface IWcfServer
{
	[OperationContract]
	void LongRunningFunction();
	[OperationContract]
	void StopLongRunningFunction();
}

WCF Service :

[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall,ConcurrencyMode=ConcurrencyMode.Multiple)]
public class WfcServer : IWcfServer
{
        public static bool needToExit = false;
	public void LongRunningFunction()
	{
		Thread t = new Thread(LongRunningProcess);
		t.Start();
		t.Join();
	}
	public void StopLongRunningFunction()
	{
		needToExit = true;
	}
	private void LongRunningProcess ()
	{
		while (true) {
                        if(needToExit)
                                  break;
			System.Threading.Thread.Sleep(1000);
		}
	}
}

Config file

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <behaviors>
      <serviceBehaviors>
        <behavior name="SampleWcf.WfcServerBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webHttpBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="webHttpBind"/>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="SampleWcf.WfcServer"
behaviorConfiguration="SampleWcf.WfcServerBehavior">
        <endpoint name="WfcServer" address="" binding="webHttpBinding"
                  bindingConfiguration="webHttpBind"
contract="WcfInterface.IWcfServer"
                  behaviorConfiguration="webHttpBehavior"/>
      </service>
    </services>
  </system.serviceModel>
</configuration>

WCF Client:

>From WCF Client first i will call LongRunningFunction() and then
StopLongRunningFunction(). My issue is in calling StopLongRunningFuction().
StopLongRunningFuction() get called after a long time (nearly 5 min).
Please help me to resolve this issue.
 

Thanks & Regards
Sheen




--
View this message in context: http://mono.1490590.n4.nabble.com/Mono-WCF-tp4656979.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list