0
That is the mistake:
An exception of type 'System.ServiceModel.CommunicationException' occurred in System.ServiceModel.ni.dll but was not handled in user code
Additional information: The remote server returned an error: NotFound.
I have two Projects:
1st Webservice, to run the Web Service
WebService.asmx:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService : System.Web.Services.WebService
{
[WebMethod]
public Boolean Autenticar(string usuario, string senha)
{
if (usuario == "admin" && senha == "admin")
return true;
return false;
}
}
2nd Windowsphone, use emulator to run.
Reference was added with the name "Dadosservice" and link "http:/ /localhost:27128/Webservice.asmx" (no spaces)
MainPage.xaml.cs
private void btnOk_Click(object sender, RoutedEventArgs e)
{
DadosService.WebServiceSoapClient service = new DadosService.WebServiceSoapClient();
service.AutenticarCompleted += service_AutenticarCompleted;
service.AutenticarAsync("admin", "admin");
}
public void service_AutenticarCompleted(object sender, DadosService.AutenticarCompletedEventArgs e)
{
if (e.Result)
{
MessageBox.Show("Certo");
}
else
{
MessageBox.Show("Errado");
}
}
@Thiagosilva published it on IIS as "http://192.168. 2.102:8080/Service/" and still gives the same error
– Leonardo
@Tiagosilva I can’t do it!
– Leonardo