简体   繁体   English

连接android模拟器到localhost webservice [C#]

[英]connect with a android emulator to the localhost webservice [C#]

i have a emulator (from Xamarin Studios, its a android) now i develop a app for this emulator, they must be connect to the web Service (localhost), which i write with C# in Visual Studio. 我有一个模拟器(来自Xamarin工作室,它是一个机器人)现在我为这个模拟器开发一个应用程序,他们必须连接到Web服务(localhost),我在Visual Studio中使用C#编写。 But the emulator dont connect to the localhost and dont can see the site. 但模拟器不连接到本地主机,也不能看到该网站。 I want to write a webservice with any functions (connect to database, select, update and so on) and i want that the app can connect to this web service and can be use the function. 我想写一个带有任何功能的web服务(连接数据库,选择,更新等),我希望应用程序可以连接到这个Web服务,并可以使用该功能。

i hope someone can help me. 我希望有一个人可以帮助我。

greetz 格尔茨

Your Android emulator's localhost will be the Android emulator itself. 您的Android模拟器的localhost将是Android模拟器本身。 You will need to connect to your webservice using the actual IP address of your machine. 您需要使用机器的实际IP地址连接到您的Web服务。 If you are running your webservices using the VS host, keep in mind that it will not serve to non-local addresses by default. 如果您使用VS主机运行Web服务,请记住默认情况下它不会提供给非本地地址。

Host that service in your IIS 在IIS中托管该服务

then call by HTTP methods with url like 然后用HTTP方法调用url之类的

http://localhost(or Ip address)/Urservicename.svc/ServicefunctionName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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