Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Issue with saving ShippingProviderParameters (Version: 9.11 (build: 1)


Hello all

Maybe somebody saw same error. While saving parameters of ShippingProvider I am getting following exception


Server Error in '/' Application.

Column 'ShippingOptionParameterId' is constrained to be unique.  Value '3' is already present.

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.Data.ConstraintException: Column 'ShippingOptionParameterId' is constrained to be unique.  Value '3' is already present.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[ConstraintException: Column 'ShippingOptionParameterId' is constrained to be unique.  Value '3' is already present.]
   System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +1697124
   System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +53
   System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) +2350
   System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows) +268
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +66
   Mediachase.Data.Provider.SqlDataProvider.SaveRows(DataCommand command) +1231
   Mediachase.Commerce.Storage.DataHelper.SaveDataSetSimple(DataCommand cmd, DataSet set, String[] tables) +66
   Mediachase.Commerce.Orders.Managers.ShippingManager.SaveShipping(ShippingMethodDto dto) +388
   Mediachase.Commerce.Manager.Order.Shipping.ShippingOptionEdit.EditSaveControl_SaveChanges(Object sender, SaveEventArgs e) +634
   Mediachase.Commerce.Manager.Core.SaveControl.OnSaveChanges(Object sender, EventArgs e) +61
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11802193
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1735


When I look into [dbo].[ShippingOptionParameter], table is empty. On repeated attempts to save, it just increases the identity that bounced, but doesn't write to the table. I tried to RESEED it, and it behaves the same, just throws with id being taken from 1 and on.

I also looked into it with SQL profiler, and this is what it attempts to do

exec sp_executesql N'INSERT INTO [ShippingOptionParameter] ([ShippingOptionId],[Parameter],[Value]) VALUES (@ShippingOptionId,@Parameter,@Value); SELECT SCOPE_IDENTITY() AS [ShippingOptionParameterId]',N'@ShippingOptionId uniqueidentifier,@Parameter nvarchar(50),@Value nvarchar(255)',@ShippingOptionId='94449DF4-4C9E-45F9-9AFF-A3F07CC96247',@Parameter=N'Consignor.IsProduction',@Value=N'false'

When I alter it to 

  INSERT INTO [ShippingOptionParameter] 
	([ShippingOptionId],[Parameter],[Value]) VALUES 
	('[MyGuidOptionId here]','[MyValueHere]','false'); 

That one row get's inserted. Now back to the form where I have couple of parameters to save. Did anyone see such exception, what might be the reason?

Thanks in advance

Sep 22, 2016 15:59

It seems to me that you are using a custom shipping gateway? Is it possible to post its code here?


Sep 23, 2016 14:28
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.