写的silverlight调用webservice访问数据库,在本地debug的时候正常,发布之后总是程序运行不起来,取不了数据,请问什么问题?
webservice
------解决方案--------------------
什么异常呢?
------解决方案--------------------
是webservice部署的有问题吧?或者配置有误?
------解决方案--------------------
webservice如下所示方式编写
[WebMethod(Description = "上传文件")]
public bool UploadFile(byte[] FileByte, string FolderPath, string FileName)
{
return new Doe.Business.Common.FileUpload().Upload(FileByte, FolderPath, FileName);
}
若是由多个webservice组成的web应用程序或者网站,将其挂到IIS上
------解决方案--------------------
public static APIServiceSoapClient GetApiService()
{
string uri = CommonProperties.DoeSettings["MYService"];
EndpointAddress addr = new System.ServiceModel.EndpointAddress(uri);
OKServiceSoapClient client = new OKServiceSoapClient(DefaultBinding, addr);
var binding = client.Endpoint.Binding as BasicHttpBinding;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.ReceiveTimeout = TimeSpan.MaxValue;
return client;
}
给每个服务下个方法调用,不要总是new,这样发布之后出问题几率叫小,方法中把配置也写进去