可以在 ServiceReferences.ClientConfig 中配置,不过个人习惯使用后台代码,毕竟配置最灵活:
BasicHttpBinding 在 Debug/ Release 时的代码配置
C# code
defaultBasicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None)
{
Name = "DefaultBasicHttpBinding",
OpenTimeout = new TimeSpan(0, 1, 0),
CloseTimeout = new TimeSpan(0, 1, 0),
#if DEBUG
SendTimeout = new TimeSpan(0, 18, 00),
ReceiveTimeout = new TimeSpan(18, 18, 00),
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue
#else
SendTimeout = new TimeSpan(0, 8, 00),
ReceiveTimeout = new TimeSpan(0, 18, 00),
MaxBufferSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue
#endif
}
CustomBinding
C# code
customBinding = new CustomBinding()
{
Name = "CustomBinding",
OpenTimeout = new TimeSpan(0, 1, 0),
CloseTimeout = new TimeSpan(0, 1, 0),
#if DEBUG
SendTimeout = new TimeSpan(0, 18, 00),
ReceiveTimeout = new TimeSpan(18, 18, 00),
#else
SendTimeout = new TimeSpan(0, 8, 00),
ReceiveTimeout = new TimeSpan(0, 18, 00),
#endif
}
customBinding.Elements.Add(new System.ServiceModel.Channels.BinaryMessageEncodingBindingElement())
customBinding.Elements.Add(new HttpTransportBindingElement()
{
MaxBufferSize = int.MaxValue, MaxReceivedMessageSize= int.MaxValue
}
)
你应该在connection string中使用attach方式加载并连接数据库的吧。这个需要sql server express才工作。 安装Visual Studio默认会安装相应版本的sql server express.public int SaveAssessmentEmp(Guid mainId, string selfEvaluation, string deptSuggest, string transferIdea){
var item = repository.GetData(mainId)
if (item != null)
{
item.SelfEvaluation = selfEvaluation
item.DeptSuggest = deptSuggest
item.TransferIdea = transferIdea
return repository.Update(item)
}
else return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)