silverlight发布到IIS,提示远程服务器返回了错误:NotFound
我的silverlight程序,在调试的时候没有任何问题,发布到IIS后,界面显示,包括数据显示都没有问题,可是涉及到往数据库插入数据的操作,就提示以下错误:
System.ServiceModel.CommunicationException:远程服务器返回了错误:NotFound.-->System.Net.WebException:远程服务器返回了错误:NotFound
实例化客户端连接服务的代码如下:
public class Setting
{
private static string url;
public static string WebServiceUrl
{
set
{
url = "../WebService.asmx";
}
get
{
return url;
}
}
public static WebServiceSoapClient GetDynamicClient()
{
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
return new WebServiceSoapClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, WebServiceUrl)));
}
}
WebServiceSoapClient ws = Setting.GetDynamicClient();
ws.InsideFileInsertCompleted += (s, r) =>
{
if (r.Error != null)
{
MessageBox.Show(r.Error.ToString());
}
tb = new TextBlock();
tb.Margin = new Thickness(11, 11, 11, 0);
tb.TextWrapping = TextWrapping.Wrap;
tb.Text = DateTime.Now.ToLongTimeString() + " " + ofd.File.Name + "已经上传完成。";
messagePanel.Children.Insert(1, tb);
Storyboard1.Begin();
List<OFFICE_T_INSIDEFILE> list = insideDataGrid.ItemsSource as List<OFFICE_T_INSIDEFILE>;
list.Add(model);
insideDataGrid.ItemsSource = null;
insideDataGrid.ItemsSource = list;
};
ws.InsideFileInsertAsync(model, b);
[解决办法]
你在本地直接调用服务器端的服务试试呢,应该是你调用服务器端的服务插入数据库有问题。
[解决办法]
在webservice端做个错误日志记录吧
[解决办法]
服务获取不到数据