2013-05-17 42 views
4

我開發了一個使用ASP.Net 3.5和C#的電子商務網站。它在Visual Stdio 2010中運行良好。我將公司文件夾下的我的網站上傳到了我的域中。 它顯示如下錯誤:Local and server-side errorsC中的服務器託管錯誤#

點擊查看完整大小,或者這裏是從本地錯誤頁面的堆棧跟蹤片段。

的NullReferenceException:對象沒有設置爲一個對象
SageFrame.Framework.PageBase.OptimizeJs(List`1 lstJsColl,的Int32模式)7940個
SageFrame.Framework.PageBase.LoadModuleJs的實例()+ 944
SageFrame.Framework.PageBase.OnPreRender(EventArgs五)+233
System.Web.UI.PreRenderRecursiveInternal()+107

它以前做工精細!

在Page_Load的代碼()是:

protected void Page_Load(object sender, EventArgs e) 
    { 
     string selectedCurrency = string.Empty; 
     string MainCurrency = string.Empty; 
     try 
     { 
      StoreSettingConfig ssc = new StoreSettingConfig(); 
      MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, GetStoreID, GetPortalID, GetCurrentCultureName); 
      if (Session["SelectedCurrency"] != null && Session["SelectedCurrency"] != "") 
      { 
       selectedCurrency = Session["SelectedCurrency"].ToString(); 
      } 
      else 
      { 
       selectedCurrency = MainCurrency; 
      } 

      string islive = Request.Form["custom"]; 
      string test = string.Empty; 
      const string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr"; 
      const string strLive = "https://www.paypal.com/cgi-bin/webscr"; 
      test = bool.Parse(islive.Split('#')[6]) ? strSandbox : strLive; 

      var req = (HttpWebRequest)WebRequest.Create(test); 
      //Set values for the request back 
      req.Method = "POST"; 
      req.ContentType = "application/x-www-form-urlencoded"; 
      byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength); 
      string strRequest = Encoding.ASCII.GetString(param); 
      strRequest += "&cmd=_notify-validate"; 
      req.ContentLength = strRequest.Length; 
      var streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII); 
      streamOut.Write(strRequest); 
      streamOut.Close(); 
      var streamIn = new StreamReader(req.GetResponse().GetResponseStream()); 
      string strResponse = streamIn.ReadToEnd(); 
      streamIn.Close();    
      if (strResponse == "VERIFIED") 
      { 
       string payerEmail = Request.Form["payer_email"]; 
       string paymentStatus = Request.Form["payment_status"]; 
       string receiverEmail = Request.Form["receiver_email"]; 
       string amount = Request.Form["mc_gross"]; 
       string invoice = Request.Form["invoice"]; 
       string addressName = Request.Form["address_name"]; 
       string addressStreet = Request.Form["address_street"]; 
       string addressCity = Request.Form["address_city"]; 
       string addressZip = Request.Form["address_zip"]; 
       string addressCountry = Request.Form["address_country"]; 
       string transID = Request.Form["txn_id"]; 
       string custom = Request.Form["custom"]; 

       string[] ids = custom.Split('#'); 
       int orderID = int.Parse(ids[0]); 
       int storeID = int.Parse(ids[1]); 
       int portalID = int.Parse(ids[2]); 
       string userName = ids[3]; 
       int customerID = int.Parse(ids[4]); 
       string sessionCode = ids[5]; 
       string pgid = ids[7]; 

       var tinfo = new TransactionLogInfo(); 
       var tlog = new TransactionLog(); 

       tinfo.TransactionID = transID; 
       tinfo.AuthCode = ""; 
       tinfo.TotalAmount = decimal.Parse(amount); 
       tinfo.ResponseCode = "1"; 
       tinfo.ResponseReasonText = ""; 
       tinfo.OrderID = orderID; 
       tinfo.StoreID = storeID; 
       tinfo.PortalID = portalID; 
       tinfo.AddedBy = userName; 
       tinfo.CustomerID = customerID; 
       tinfo.SessionCode = sessionCode; 
       tinfo.PaymentGatewayID = int.Parse(pgid); 
       tinfo.PaymentStatus = paymentStatus; 
       tinfo.PayerEmail = payerEmail; 
       tinfo.CreditCard = ""; 
       tinfo.RecieverEmail = receiverEmail; 
       tinfo.CurrencyCode = selectedCurrency; 
       tlog.SaveTransactionLog(tinfo); 


       if (paymentStatus.Equals("Completed")) 
       {      
        var paypalobj = new PayPalHandler(); 
        paypalobj.ParseIPN(orderID, transID, paymentStatus, storeID, portalID, userName, customerID, sessionCode); 
       } 


      } 
      else if (strResponse == "INVALID") 
      { 
       //log for manual investigation 
      } 
      else 
      { 
       //log response/ipn data for manual investigation 
      } 
      // } 
     } 
     catch (Exception ex) 
     { 
      ProcessException(ex); 
      // throw new Exception("This Page is not accessible!"); 
     } 
    } 
+0

確保您的IIS服務器運行.Net Framework的正確版本。 – alexandrekow

回答

2

從錯誤信息,看來你的店庫無法加載。這可能是因爲它未安裝在服務器上,或者信任級別太低。

無論哪種方式,您的託管服務提供商可以協助安裝。