我有一个基于web的asp.net应用程序,现在我们尝试使用angularjs进行升级。
我有一个网络服务:
[WebMethod]
public void UpdateUnapprovedNames(string nameId, string BU, string strToChecksum)
{
//Update approved names
string error = "";
int newChecksum = 0;
try
{
PaymentDALC paymentDALC = new PaymentDALC();
string userId= (string)Session["USERID"];
newChecksum = gpi.Classes.validation.getCheckSum(strToChecksum + "Y");
var ds1 = gpi.Classes.dbfunctions.UpdateApprovedNames(nameId, newChecksum, userId, userId, BU);
UpdateUnApprovedPaymentsForName(nameId, BU);
}
catch (Exception ex)
{
error = ex.Message;
}
Context.Response.Write(js.Serialize(error));
}
然后Angularjs启动$ http方法,当进入Web服务时,在visualstudio中:
PaymentDALC paymentDALC = PaymentDALC();
转到捕获语句,错误是:
“对象引用未设置为对象的实例。”
在此网络方法上,我还有其他可以访问的类。例如,可以访问gpi.Classes.dbfunctions.UpdateApproveNames。 班级建设是:
using System;
using System.Text;
using System.Data;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Web;
using System.Collections;
using System.ServiceModel;
using System.Collections.Generic;
using Ace.GPI.Classes;
using Ace.GPI.Classe.ACHValidation;
namespace gpi.Classes
{
/// <summary>
/// Summary description for validation.
/// </summary>
public class validation
{
string b = "";
public static bool accBool;
public static bool bankBool;
private const int seed = 33;
但是另一个是:
using System;
using System.Configuration;
using System.Collections;
using System.Data;
using System.Text;
using System.Collections.Specialized;
using ACE.ApplicationBlocks.DB2Data;
using IBM.Data.DB2;
using System.Web.Mail;
using System.Data.Odbc;
using System.Xml;
using System.Web;
using System.Data.OleDb;
using System.Linq;
namespace gpi
{
/// <summary>
/// The PaymentDALC performs all database access related to Payment and PaymentQueue
/// </summary>
public class PaymentDALC : BaseDALC
{
static string DB_ENCRYPTION_KEY = ((ConfigPortal)HttpContext.Current.Session["PortalConfiguration"]).DBEncryptionKey;//Def 730
public PaymentDALC()
: base()
{
}
继承还是构造函数有些麻烦? 或为什么不能实例化这堂课? 由于智能感知不会显示任何错误。
谢谢您的帮助。