简体   繁体   中英

How to accessing WCF APIs in Silverlight?

i created an WCF API in my silverlight web project using Silverlight enabled WCF Services with name API.

I added operation contract logic in this :

[OperationContract]
 public int AddNums(int a, int b)
 {
    return (a + b);
 } 

Now i added a Service Reference named "APIRef" in SilverLight Client project.

Now i know one way to access it using http://localhost:2250/API.svc and it show some information regarding the API etc

But i want that a remote device can access the AddNums(a,b) method

How can i access this....please give guide

Thanks

You should have a stub class on client side after adding the service reference. You need to include it and call the method eg

APIRefClient.AddNums(x,y);

The important thing is, to take the ***Client class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM