webservice报错如下:
System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.TypeInitializationException: “CarTestWebservice.DAL.DBHelper”的类型初始值设定项引发异常。 ---> System.NullReferenceException: 未将对象引用设置到对象的实例。
在 CarTestWebservice.DAL.DBHelper..cctor()
--- 内部异常堆栈跟踪的结尾 ---
在 CarTestWebservice.DAL.DBHelper.ExecuteInsertStoreProcedure(SqlParameter[] param, String storeName)
在 CarTestWebservice.DAL.TestRecordDAL.InsertOneTestRecord(String writeXmlDoc)
在 CarTestWebservice.Web.Service.write(String xmlDoc)
--- 内部异常堆栈跟踪的结尾 ---
service代码:
[WebMethod]
public string writeObjectOut(string xtlb, string jkxlh, string jkid, string WriteXmlDoc)
{
string resultXmlDoc = null;
if(xtlb == "01"&&jkid == "01C71")
{
TestRecordDAL record = new TestRecordDAL();
resultXmlDoc = record.InsertOneTestRecord(WriteXmlDoc);//这是我现在主要测试的代码,其他if中的没有用。
}
else if (xtlb == "01" && jkid == "01C72")
{
TestResult result = new TestResult();
resultXmlDoc = result.InsertOneTestResult(WriteXmlDoc);
}
else if (xtlb == "01" && jkid == "01C75")
{
JtsdzrbxInfoDAL bxinfo = new JtsdzrbxInfoDAL();
resultXmlDoc = bxinfo.InsertOnetJDCJTSGZRQZBXInfo(WriteXmlDoc);
}
else if (xtlb == "01" && jkid == "01C01")
{
CarRegisterDAL register = new CarRegisterDAL();
resultXmlDoc = register.InsertOneCarRegister(WriteXmlDoc); ;
}
return resultXmlDoc;
}