Can't use e-commerce module in shared hosting-please advise!

Last post 04-27-2008 10:37 PM by digital_creativity. 2 replies.

Sort Posts:

  • Can't use e-commerce module in shared hosting-please advise!

    04-26-2008, 6:21 PM

    I'm using a shared host to run a modified version of The Beer House e-commerce module (using www.DiscountASP.NET)  However, they (and most shared hosts) don't support Distributed Transaction Processing, which The Beer House uses.  So I get this error when trying to submit an order to PayPal:

     

    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

    Source Error:

    Line 658:            cmd.Parameters.Add("@Quantity", SqlDbType.Int).Value = orderItem.Quantity;
    Line 659:            cmd.Parameters.Add("@OrderItemID", SqlDbType.Int).Direction = ParameterDirection.Output;
    Line 660:            cn.Open();
    Line 661:            int ret = ExecuteNonQuery(cmd);
    Line 662:            return (int)cmd.Parameters["@OrderItemID"].Value;


    Source File: e:\web\joleneandaa\htdocs\App_Code\DAL\SqlClient\SqlStoreProvider.cs    Line: 660

    I got the following message back from my host:

    "Due to security concerns, I'm afraid that we will not be able to provide access to the Microsoft Distributed Transaction Coordinator. If your application requires transactions, ASP.NET web transactions are not supported, however, you can use the SQL Transaction class as an alternative as a workaround."

     So does anyone know how I would convert to using the SQL Transaction class?  Or does anyone know of a host that supports shared Distributed Transaction Processing?  I would hate to scrap all of the work I've done. 

    This is the code that comes up in the debugger:

    public override int InsertOrderItem(OrderItemDetails orderItem)

    {

    using (SqlConnection cn = new SqlConnection(this.ConnectionString))

    {

    SqlCommand cmd = new SqlCommand("tbh_Store_InsertOrderItem", cn);

    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = orderItem.AddedDate;

    cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = orderItem.AddedBy;

    cmd.Parameters.Add("@OrderID", SqlDbType.Int).Value = orderItem.OrderID;

    cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = orderItem.ProductID;

    cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = orderItem.Title;

    cmd.Parameters.Add("@SKU", SqlDbType.NVarChar).Value = orderItem.SKU;

    cmd.Parameters.Add("@UnitPrice", SqlDbType.Money).Value = orderItem.UnitPrice;

    cmd.Parameters.Add("@Quantity", SqlDbType.Int).Value = orderItem.Quantity;

    cmd.Parameters.Add("@OrderItemID", SqlDbType.Int).Direction = ParameterDirection.Output;

    cn.Open(); //This is where the error occurs

    int ret = ExecuteNonQuery(cmd);return (int)cmd.Parameters["@OrderItemID"].Value;

    }

    }

     

    Thanks!

  • Re: Can't use e-commerce module in shared hosting-please advise!

    04-27-2008, 3:24 PM
    • Loading...
    • Lee Dumond
    • Joined on 11-03-2004, 10:51 AM
    • Decatur, IL USA
    • Posts 854

    I assure you that none of TheBeerHouse code uses the MSDTC, so that's not your issue.

    The application indeed uses transactions, but they are all local transactions, not distributed.

    If you examine your error, you'll note that it has nothing to do with the transaction anyway. The application is not letting the ASP.NET request identity open your connection. That is a permissions issue. So, that's where you need to be looking.

    // ******************************
    if (this.PostHelpedYou)
    {
    MarkAsAnswer();
    }
  • Re: Can't use e-commerce module in shared hosting-please advise!

    04-27-2008, 10:37 PM

    Thanks.  I ended up switching to a new host that supports MSDTC, and it works now.  Not sure if was exactly that, or a permissions issue like you said, but it works now.  By the way, the host is www.appliedi.net is you're looking for a host that supports distributed transactions.  Their support people helped me get this up and running... so far so good.

Page 1 of 1 (3 items)