怀疑我的winApplication使用WCF服务 [英] doubt in my winApplication using WCF service

查看:91
本文介绍了怀疑我的winApplication使用WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了名为WcfSample1的wcf服务(它托管在服务器的iis中)并创建了win App,命名为WinSamp(这是我本地系统中的一个)。

在WinSamp应用程序中添加了WcfSample1的服务参考




我尝试以下两种方法。



I had created wcf service named as "WcfSample1"(which is hosted in server's iis) and created win App Named as "WinSamp"(Which is in one of my local system).
In WinSamp app added servicereference for "WcfSample1"


I try the below two methods.

private void button1_Click(object sender, EventArgs e)
        {
            //manual wcf service link for this Application
            WSHttpBinding binding = new WSHttpBinding();
            EndpointAddress endpoint = new EndpointAddress(new Uri("http://197.168.0.11//WcfSample1/Service1.svc"));
            Service1Client Client1 = new Service1Client(binding,endpoint);
            MessageBox.Show(Client1.GetData(Convert.ToInt16(textBox1.Text)));
        }







<pre lang="c#">
private void button1_Click(object sender, EventArgs e)
        {
            Service1Client Client1 = new Service1Client();
            MessageBox.Show(Client1.GetData(Convert.ToInt16(textBox1.Text)));
        }
</pre>







但它显示错误,错误图片在以下链接



点击查看错误图片



但它在我的serverPC中工作...



在此先感谢...!




but it shows the error, The error image is in below link

Click to view Error Image

But it is working in my serverPC...

Thanks in advance...!

推荐答案

从错误中可以看出,从两个不同的环境调用时的身份验证问题。



试试这个选项。可能会给你一些线索。



如何-DO-通的凭据,在-AN- iis-hosted-wcf-service [ ^ ]

< a href =http://stackoverflow.com/questions/19104140/not-passing-credentials-to-wcf-service-resulting-in-a-401> not-passing-credentials-to-wcf-service-results -in-a-401 [ ^ ]
Its evident from the error that the issue with the authentication when call from two different environment.

Try this options. Might be it give you some clue.

how-do-i-pass-credentials-in-an-iis-hosted-wcf-service[^]
not-passing-credentials-to-wcf-service-resulting-in-a-401[^]


这篇关于怀疑我的winApplication使用WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆