C# Task.Factory.NewTask and WCF. Why I'm doing wrong? -


i have application in wcf runs in machines on customer. 1 works server in net.

in model, every time wcf "client" called, call wcf "server" obtain response.

so, have configuration on interface:

[webinvoke(bodystyle = webmessagebodystyle.wrappedrequest)] [operationcontract] myobjectreturn checkupdate(string foo1, string foo2, string foo3); 

in code, this:

myobjectreturn myobjreturn = new myobjectreturn(); if (this.master) {    myobjreturn.code = 15000;    myobjreturn.message = "new update found";    return myobjreturn; } else {    var mytask = task<myobjectreturn >.factory.startnew(() =>    {       servercontractclient server = new servercontractclient(master.url);       return server.checkupdate(foo1, foo2, foo3);    }     return mytask.result; }  

when wcf "client" calls "server", return null! if not use "task . factory.startnew", bad request error

any tip?

uh, first, "server" , "client" preferred nomenclatures.

second, servy has point if want data immediately, there's no real point in starting thread. said, threads fun! doesn't want thread? you'll have revise application bit, you'll @ least have design wcf method asynchronous, , client making call needs know it's asynchronous; otherwise result null, experienced. best starting point here.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -