开发者

WCF service code in window application

开发者 https://www.devze.com 2022-12-31 18:35 出处:网络
I am using C#.net application code. I require to call service for Window Application and i am using below code to open service Host,

I am using C#.net application code.

I require to call service for Window Application and i am using below code to open service Host,

 using (ServiceHost host = new ServiceHost(
                typeof(class1),
                new Uri[] { new Uri("net.pipe://localhost") })
                )
            {
}

& Then we have clinet Console application to connect to serviceHost.

Problem is,

When i create service/Client application Using C开发者_StackOverflow社区onslole Application both are working fine. But if i call servide code form Window application to connect to console client it gives Error for Binding Error like("No End Point/Address found to test")

Can any one help me to run service from C# window application ?

Thanks


You have a using statement wrapped around your host. Once it goes out of scope, it is closed. Make the host a class member of your form. I usually also open it in a separate thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号