Click here to Skip to main content
15,913,773 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: UserControl question Pin
Gideon Engelberth1-May-09 6:03
Gideon Engelberth1-May-09 6:03 
GeneralRe: UserControl question Pin
AghaKhan1-May-09 6:17
AghaKhan1-May-09 6:17 
GeneralRe: UserControl question Pin
Gideon Engelberth1-May-09 11:49
Gideon Engelberth1-May-09 11:49 
GeneralRe: UserControl question Pin
AghaKhan1-May-09 18:56
AghaKhan1-May-09 18:56 
GeneralRe: UserControl question Pin
RugbyLeague1-May-09 9:19
RugbyLeague1-May-09 9:19 
GeneralRe: UserControl question Pin
Gideon Engelberth1-May-09 17:09
Gideon Engelberth1-May-09 17:09 
AnswerRe: UserControl question Pin
fjparisIII3-May-09 2:22
fjparisIII3-May-09 2:22 
QuestionMy WCF client deadlock Pin
Richard Dutton1-May-09 4:32
Richard Dutton1-May-09 4:32 
Hi,

I've got a simple ServiceContract as follows:
[ServiceContract]
public interface ITestContractCallback
{
    [OperationContract(IsOneWay = true)]
    void CallBackFunc();
}

[ServiceContract(CallbackContract=typeof(ITestContractCallback))]
public interface ITestContract
{
    [OperationContract(IsOneWay = false)]
    ulong GetValue();
}

My server code looks like this:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class Server : ITestContract
{
    public static ITestContractCallback _callback;
    public Thread _callbackHammererThread;

    public Server()
    {
        _callback = OperationContext.Current.GetCallbackChannel<ITestContractCallback>();
        _callbackHammererThread = new Thread(CallbackHammererThread);
        _callbackHammererThread.Start();
    }

    public static void CallbackHammererThread()
    {
        while (true)
        {
            if (_callback != null)
            {
                _callback.CallBackFunc();
            }
            Thread.Sleep(1);
        }
    }

    #region ITestContract Members

    public ulong GetValue()
    {
        return 100000;
    }
    #endregion
}

class Program
{
    static void Main(string[] args)
    {
        NetTcpBinding binding = new NetTcpBinding();
        ServiceHost host = new ServiceHost(typeof(Server));
        Uri BaseAddressString = new Uri("net.tcp://localhost:1337/test");
        host.AddServiceEndpoint(typeof(ITestContract), new NetTcpBinding(), BaseAddressString);
        host.Open();
        Application.Run();
        host.Close();
    }
}


And I've written a noddy WPF Application which connects to this server and, when a button is pressed displays the value of 'GetValue()' in a field. This works fine if I disable the CallbackHammererThread in the server but when it's continually hitting the callback on the client, my call to 'GetValue()' just freezes the whole GUI until the WCF TCP connection times out and throws an exception.

Debugging and using wireshark I can see that the server gets the call and returns the response but I can't figure out how to fix the deadlocking that appears to be caused in the client thread.

Can anyone help? This is occuring in a larger WPF + WCF appliction I'm currently working on and I'm finding it impossible to work out.

Thanks

Richard
QuestionDependency properties!Performance issue Pin
pioner30-Apr-09 19:48
pioner30-Apr-09 19:48 
AnswerRe: Dependency properties!Performance issue Pin
Gideon Engelberth1-May-09 3:27
Gideon Engelberth1-May-09 3:27 
QuestionSaving image transform without losing metadata Pin
fjparisIII30-Apr-09 6:35
fjparisIII30-Apr-09 6:35 
AnswerRe: Saving image transform without losing metadata Pin
fjparisIII30-Apr-09 8:47
fjparisIII30-Apr-09 8:47 
GeneralRe: Saving image transform without losing metadata (NOT SOLVED: where is everybody?) Pin
fjparisIII30-Apr-09 15:01
fjparisIII30-Apr-09 15:01 
GeneralRe: Saving image transform without losing metadata Pin
fjparisIII2-May-09 17:16
fjparisIII2-May-09 17:16 
GeneralRe: Saving image transform without losing metadata Pin
fjparisIII3-May-09 16:53
fjparisIII3-May-09 16:53 
AnswerRe: Saving image transform without losing metadata Pin
Pete O'Hanlon4-May-09 9:12
mvePete O'Hanlon4-May-09 9:12 
GeneralRe: Saving image transform without losing metadata Pin
fjparisIII4-May-09 9:36
fjparisIII4-May-09 9:36 
GeneralRe: Saving image transform without losing metadata Pin
Pete O'Hanlon4-May-09 9:42
mvePete O'Hanlon4-May-09 9:42 
GeneralRe: Saving image transform without losing metadata Pin
fjparisIII4-May-09 9:58
fjparisIII4-May-09 9:58 
GeneralRe: Saving image transform without losing metadata Pin
Pete O'Hanlon4-May-09 10:06
mvePete O'Hanlon4-May-09 10:06 
GeneralRe: Saving image transform without losing metadata Pin
fjparisIII20-May-09 14:59
fjparisIII20-May-09 14:59 
GeneralRe: Saving image transform without losing metadata Pin
fjparisIII22-May-09 13:25
fjparisIII22-May-09 13:25 
QuestionCookies vs. isolated Storage Pin
Ray Cassick30-Apr-09 3:44
Ray Cassick30-Apr-09 3:44 
AnswerRe: Cookies vs. isolated Storage Pin
Mark Salsbery30-Apr-09 6:00
Mark Salsbery30-Apr-09 6:00 
AnswerRe: Cookies vs. isolated Storage Pin
GuinnessKMF4-May-09 3:28
GuinnessKMF4-May-09 3:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.