访问asmx服务老是出错?远程服务器返回了错误: NotFound。
1、我可以访问DateTimeService.asmx,并且页面上可以调用。
2
MainPage.xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SilverlightApplication4.DateTimeService;
namespace SilverlightApplication4
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
void button1_Click(object sender, RoutedEventArgs e)
{
DateTimeService.DateTimeServiceSoapClient service = new SilverlightApplication4.DateTimeService.DateTimeServiceSoapClient();
service.HelloWorldCompleted +=new EventHandler<DateTimeService.HelloWorldCompletedEventArgs>(service_HelloWorldCompleted);
service.HelloWorldAsync();
}
void service_HelloWorldCompleted(object sender, DateTimeService.HelloWorldCompletedEventArgs e)
{
textBlock1.Text = e.Result;
}
}
}