зеркало из https://github.com/mono/mail-archives.git
209 строки
9.0 KiB
HTML
209 строки
9.0 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Mono-osx] Mono - WCF
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=Re%3A%20%5BMono-osx%5D%20Mono%20-%20WCF&In-Reply-To=%3CCACR7UhBxk3fj2TpUKeRqho2ayNC4-mTk%2BU6ejN8j6c%2BW%2BG5ytg%40mail.gmail.com%3E">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
<style type="text/css">
|
||
|
pre {
|
||
|
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
|
||
|
}
|
||
|
</style>
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
||
|
<LINK REL="Previous" HREF="005101.html">
|
||
|
<LINK REL="Next" HREF="005103.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Mono-osx] Mono - WCF</H1>
|
||
|
<B>Sheen Chandy</B>
|
||
|
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=Re%3A%20%5BMono-osx%5D%20Mono%20-%20WCF&In-Reply-To=%3CCACR7UhBxk3fj2TpUKeRqho2ayNC4-mTk%2BU6ejN8j6c%2BW%2BG5ytg%40mail.gmail.com%3E"
|
||
|
TITLE="[Mono-osx] Mono - WCF">sheenchandy at verifaya.com
|
||
|
</A><BR>
|
||
|
<I>Wed Oct 17 05:32:55 UTC 2012</I>
|
||
|
<P><UL>
|
||
|
<LI>Previous message: <A HREF="005101.html">[Mono-osx] Mono - WCF
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="005103.html">[Mono-osx] Mono.Cecil.ResolutionException when packaging for .Net 4.5
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#5102">[ date ]</a>
|
||
|
<a href="thread.html#5102">[ thread ]</a>
|
||
|
<a href="subject.html#5102">[ subject ]</a>
|
||
|
<a href="author.html#5102">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>Hi,
|
||
|
|
||
|
Thanks for you reply.
|
||
|
|
||
|
I tried with changing instance-context and still it is taking long
|
||
|
time to get called.
|
||
|
Actually i required concurrency here (that is why i used
|
||
|
InstanceContextMode.PerCall). When first function
|
||
|
(LongRunningFunction()) is running I need to call my second function
|
||
|
(StopLongRunningFunction()).
|
||
|
I am sorry i made one mistake in my sample code, the 'Thread' i am
|
||
|
creating in LongRunningFunction() is actually a static one so that
|
||
|
every instance can access that thread.
|
||
|
|
||
|
Thanks & Regards
|
||
|
Sheen
|
||
|
|
||
|
On Wed, Oct 17, 2012 at 12:04 AM, Adam <<A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">adam at irisdesign.co.nz</A>> wrote:
|
||
|
><i> hi,
|
||
|
</I>><i>
|
||
|
</I>><i> Your problem is, your WCF setup doesnt make sense for your purpose.
|
||
|
</I>><i> You are using:
|
||
|
</I>><i> InstanceContextMode=InstanceContextMode.PerCall
|
||
|
</I>><i>
|
||
|
</I>><i> This means that a new instance of your service class is instantiated every
|
||
|
</I>><i> time a request comes in - so you will never be able to refer to an instance
|
||
|
</I>><i> of the service that started the thread (i.e., you will set ' needToExit =
|
||
|
</I>><i> true;' inside of a service that has just been created, and has no running
|
||
|
</I>><i> thread).
|
||
|
</I>><i>
|
||
|
</I>><i> You need to change to another instance-context, such as Single, or
|
||
|
</I>><i> PerSession.
|
||
|
</I>><i>
|
||
|
</I>><i> Adam
|
||
|
</I>><i>
|
||
|
</I>><i> On Wed, Oct 17, 2012 at 12:31 AM, sheen <<A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">sheenchandy at verifaya.com</A>> wrote:
|
||
|
</I>>><i>
|
||
|
</I>>><i> Hi,
|
||
|
</I>>><i>
|
||
|
</I>>><i> I have an issue in calling WCF Services.
|
||
|
</I>>><i> I will explain issue using below example
|
||
|
</I>>><i>
|
||
|
</I>>><i> WCF Interface :
|
||
|
</I>>><i>
|
||
|
</I>>><i> [ServiceContract]
|
||
|
</I>>><i> public interface IWcfServer
|
||
|
</I>>><i> {
|
||
|
</I>>><i> [OperationContract]
|
||
|
</I>>><i> void LongRunningFunction();
|
||
|
</I>>><i> [OperationContract]
|
||
|
</I>>><i> void StopLongRunningFunction();
|
||
|
</I>>><i> }
|
||
|
</I>>><i>
|
||
|
</I>>><i> WCF Service :
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i> [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall,ConcurrencyMode=ConcurrencyMode.Multiple)]
|
||
|
</I>>><i> public class WfcServer : IWcfServer
|
||
|
</I>>><i> {
|
||
|
</I>>><i> public static bool needToExit = false;
|
||
|
</I>>><i> public void LongRunningFunction()
|
||
|
</I>>><i> {
|
||
|
</I>>><i> Thread t = new Thread(LongRunningProcess);
|
||
|
</I>>><i> t.Start();
|
||
|
</I>>><i> t.Join();
|
||
|
</I>>><i> }
|
||
|
</I>>><i> public void StopLongRunningFunction()
|
||
|
</I>>><i> {
|
||
|
</I>>><i> needToExit = true;
|
||
|
</I>>><i> }
|
||
|
</I>>><i> private void LongRunningProcess ()
|
||
|
</I>>><i> {
|
||
|
</I>>><i> while (true) {
|
||
|
</I>>><i> if(needToExit)
|
||
|
</I>>><i> break;
|
||
|
</I>>><i> System.Threading.Thread.Sleep(1000);
|
||
|
</I>>><i> }
|
||
|
</I>>><i> }
|
||
|
</I>>><i> }
|
||
|
</I>>><i>
|
||
|
</I>>><i> Config file
|
||
|
</I>>><i>
|
||
|
</I>>><i> <?xml version="1.0" encoding="utf-8" ?>
|
||
|
</I>>><i> <configuration>
|
||
|
</I>>><i> <system.serviceModel>
|
||
|
</I>>><i> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
|
||
|
</I>>><i> <behaviors>
|
||
|
</I>>><i> <serviceBehaviors>
|
||
|
</I>>><i> <behavior name="SampleWcf.WfcServerBehavior">
|
||
|
</I>>><i> <serviceMetadata httpGetEnabled="true" />
|
||
|
</I>>><i> <serviceDebug includeExceptionDetailInFaults="true" />
|
||
|
</I>>><i> </behavior>
|
||
|
</I>>><i> </serviceBehaviors>
|
||
|
</I>>><i> <endpointBehaviors>
|
||
|
</I>>><i> <behavior name="webHttpBehavior">
|
||
|
</I>>><i> <webHttp />
|
||
|
</I>>><i> </behavior>
|
||
|
</I>>><i> </endpointBehaviors>
|
||
|
</I>>><i> </behaviors>
|
||
|
</I>>><i> <bindings>
|
||
|
</I>>><i> <webHttpBinding>
|
||
|
</I>>><i> <binding name="webHttpBind"/>
|
||
|
</I>>><i> </webHttpBinding>
|
||
|
</I>>><i> </bindings>
|
||
|
</I>>><i> <services>
|
||
|
</I>>><i> <service name="SampleWcf.WfcServer"
|
||
|
</I>>><i> behaviorConfiguration="SampleWcf.WfcServerBehavior">
|
||
|
</I>>><i> <endpoint name="WfcServer" address="" binding="webHttpBinding"
|
||
|
</I>>><i> bindingConfiguration="webHttpBind"
|
||
|
</I>>><i> contract="WcfInterface.IWcfServer"
|
||
|
</I>>><i> behaviorConfiguration="webHttpBehavior"/>
|
||
|
</I>>><i> </service>
|
||
|
</I>>><i> </services>
|
||
|
</I>>><i> </system.serviceModel>
|
||
|
</I>>><i> </configuration>
|
||
|
</I>>><i>
|
||
|
</I>>><i> WCF Client:
|
||
|
</I>>><i>
|
||
|
</I>>><i> From WCF Client first i will call LongRunningFunction() and then
|
||
|
</I>>><i> StopLongRunningFunction(). My issue is in calling
|
||
|
</I>>><i> StopLongRunningFuction().
|
||
|
</I>>><i> StopLongRunningFuction() get called after a long time (nearly 5 min).
|
||
|
</I>>><i> Please help me to resolve this issue.
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i> Thanks & Regards
|
||
|
</I>>><i> Sheen
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i>
|
||
|
</I>>><i> --
|
||
|
</I>>><i> View this message in context:
|
||
|
</I>>><i> <A HREF="http://mono.1490590.n4.nabble.com/Mono-WCF-tp4656979.html">http://mono.1490590.n4.nabble.com/Mono-WCF-tp4656979.html</A>
|
||
|
</I>>><i> Sent from the Mono - OSX mailing list archive at Nabble.com.
|
||
|
</I>>><i> _______________________________________________
|
||
|
</I>>><i> Mono-osx mailing list
|
||
|
</I>>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">Mono-osx at lists.ximian.com</A>
|
||
|
</I>>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">http://lists.ximian.com/mailman/listinfo/mono-osx</A>
|
||
|
</I>>><i>
|
||
|
</I>><i>
|
||
|
</I>><i>
|
||
|
</I>><i> _______________________________________________
|
||
|
</I>><i> Mono-osx mailing list
|
||
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">Mono-osx at lists.ximian.com</A>
|
||
|
</I>><i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-osx">http://lists.ximian.com/mailman/listinfo/mono-osx</A>
|
||
|
</I>><i>
|
||
|
</I></PRE>
|
||
|
|
||
|
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI>Previous message: <A HREF="005101.html">[Mono-osx] Mono - WCF
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="005103.html">[Mono-osx] Mono.Cecil.ResolutionException when packaging for .Net 4.5
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#5102">[ date ]</a>
|
||
|
<a href="thread.html#5102">[ thread ]</a>
|
||
|
<a href="subject.html#5102">[ subject ]</a>
|
||
|
<a href="author.html#5102">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
|
||
|
<hr>
|
||
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
|
||
|
mailing list</a><br>
|
||
|
</body></html>
|