运行客户端移动应用程序时出错 [英] Error running Clientside Mobile application

查看:95
本文介绍了运行客户端移动应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1-我会为你改善我的问题,因为我不会写评论服务器有问题.....
我在运行Windows XP和Vista的台式计算机中有WCF服务,并且有一个名为客户端"的移动应用程序项目...当我生成代理时,我在服务运行期间在通用提示符下执行了此步骤:

1- i will improve my question for u because i coudn''t write comment the server has problem.....
i have WCF service in my desktop computer running windows xp and vista and i have the mobile applictaion project called "Client"... when i genrated the proxy i made this step in commond prompt during the service running :

NetCFSvcUtil http://localhost:8731/Design_Time_Addresses/Server/Service1


这个生成了2个文件Greeting_Service.cs和CFClientBase.cs
而且我都把这两个都放在了Client中;

这是我在Client中的代码:


and this genrated 2 files Greeting_Service.cs and CFClientBase.cs
and i puted both in Client;

and this is my code in Client :

System.ServiceModel.Channels.Binding binding = GreetingServiceClient.CreateDefaultBinding();
           string address = GreetingServiceClient.EndpointAddress.Uri.ToString();
           GreetingServiceClient m_proxy = new GreetingServiceClient(binding, new EndpointAddress(address));
           string result = m_proxy.Greet(textBox1.Text).ToString();
           textBox2.Text = result;



当我尝试运行服务和客户端时,此部分的CFClientBase.cs中会出现上述错误
返回requestChannel.Request(msg);

我尝试从此Client \ Client \ bin \ Debug \ Client.exe运行客户端",并且运行良好

..............
当我尝试使用您的解决方案并将生成代理的命令更改为...



when i try to run the service and the client the error above is appear in CFClientBase.cs at this part
return requestChannel.Request(msg);

and i tried to run the "Client" from this Client\Client\bin\Debug\Client.exe and it run fine

..............
when i try ur solution and change my command for genrate proxy to ...

NetCFSvcUtil http://192.168.1.76:8731/Design_Time_Addresses/Server/Service1


这是相同的错误.


it is the same error.

and thx for ur replay mr fredik.

推荐答案

我不确定我是否完全了解您的情况,但对我来说,听起来您正在提供服务您尝试使用在移动设备(或仿真器)上运行的客户端访问的台式计算机上运行的计算机.

如果是这种情况,则您不能使用本地主机作为地址,因为它将指向移动设备而不是台式机.您需要使用外部" IP或主机名指定桌面的地址.

当您运行桌面客户端时,它可以工作,因为它与服务在同一盒中运行,因此localhost是正确的.

希望这会有所帮助,
弗雷德里克·博纳德(Fredrik Bornander)
I''m not sure I understand your scenario completely, but to me it sounds like you''re having a service running on your desktop computer that you''re trying to access using a client running on a mobile device (or emulator).

If this is the case then you cannot use localhost as the address because that would point to the mobile device rather than the desktop computer. You need to specify the address of the desktop using an "external" IP or host name.

It works when you''re running the desktop client because that is running on the same box as the service so localhost is correct then.

Hope this helps,
Fredrik Bornander


这篇关于运行客户端移动应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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