Quantcast
Channel: Optimizely Search & Navigation
Viewing all 6894 articles
Browse latest View live

Safe way to call async method in EPiServer scheduled job?

$
0
0

Hi!

Can anyone give an example of how to safely call an async method in an EPiServer scheduled job?

The following is - as far as I know - not safe:

IDummyRepository repo = new DummyRepository();
var dummies = repo.GetDummiesAsync().Result;

Cannot resolve the collation conflict in the equal to operation

$
0
0

I have , updated to latest EPi version today and when deploying to Azure I get an error. If you hurry you might catch this detailed error msg at my blog :-)

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Finnish_Swedish_CI_AS" in the equal to operation.

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.SqlClient.SqlException: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Finnish_Swedish_CI_AS" in the equal to operation.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ page language="C#" debug="true" %>

or:

2) Add the following section to the configuration file of your application:


   
       
   



Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.%@>

Stack Trace:

 

[SqlException (0x80131904): Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Finnish_Swedish_CI_AS" in the equal to operation.]

   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1787814

   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5341674

   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546

   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1693

   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +869

   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +413

   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +163

   EPiServer.Data.SchemaUpdates.<>c__DisplayClassa.b__8() +94>

 

[DataException: Failed to update database during execution of statement 'CREATE PROCEDURE [dbo].[netNotificationMessageGetForRecipients]

        @ScheduledBefore DATETIME2 = NULL,

        @Recipients dbo.StringParameterTable READONLY

AS

BEGIN

        SELECT

               pkID AS ID, Recipient, Sender, Channel, [Type], [Subject], Content, Sent, SendAt, Saved, [Read], Category

               FROM

                       [tblNotificationMessage] AS M INNER JOIN @Recipients AS R ON M.Recipient = R.String

               WHERE

                       Sent IS NULL AND

                       (SendAt IS NULL OR

                       (@ScheduledBefore IS NOT NULL AND SendAt IS NOT NULL AND @ScheduledBefore > SendAt))

                                     

               ORDER BY Recipient

END

']

   EPiServer.Data.SchemaUpdates.<>c__DisplayClassa.b__8() +204>

   EPiServer.Data.Providers.<>c__DisplayClass35`1.b__34() +132>

   EPiServer.Data.Providers.NoRetriesPolicy.Execute(Func`1 method) +9

   EPiServer.Data.Providers.SqlDatabaseHandler.ExecuteTransaction(Func`1 action) +124

   EPiServer.Data.SchemaUpdates.ScriptRunnerImpl.ExecuteScript(IDatabaseHandler databaseHandler, StreamReader stream) +242

   EPiServer.Data.SchemaUpdates.<>c__DisplayClass1.b__0() +164>

   EPiServer.Data.Providers.<>c__DisplayClass32.b__31() +10>

   EPiServer.Data.Providers.<>c__DisplayClass35`1.b__34() +132>

   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +45

   EPiServer.Data.Providers.SqlDatabaseHandler.ExecuteTransaction(Func`1 action) +124

   EPiServer.Data.Providers.SqlDatabaseHandler.ExecuteTransaction(Action action) +90

   EPiServer.Data.SchemaUpdates.ScriptRunnerImpl.ExecuteScripts(IDatabaseHandler databaseHandler, IEnumerable`1 streams) +87

   EPiServer.Data.SchemaUpdates.ScriptExecutorImplementation.ExecuteEmbeddedZippedScripts(String connectionString, Assembly assembly, String resourcePath) +425

   EPiServer.Data.DatabaseVersionValidator.Update(ConnectionStringSettings connectionStringSettings) +57

   EPiServer.Data.SchemaUpdates.DatabaseSchemaManagerImplementation.EnureDatabaseSchemaVersion(ConnectionStringsSection connectionStrings, Boolean automaticSchemaUpdatesEnabled) +953

   EPiServer.Data.DataInitialization.ValidateDatabaseSchema(InitializationEngine context) +142

   EPiServer.Data.DataInitialization.Initialize(InitializationEngine context) +25

   EPiServer.Framework.Initialization.<>c__DisplayClass5.b__4() +19>

   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +43

   EPiServer.Framework.Initialization.ModuleNode.Initialize(InitializationEngine context) +80

   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +173

 

[InitializationException: Initialize action failed for Initialize on class EPiServer.Data.DataInitialization, EPiServer.Data, Version=8.11.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]

   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +441

   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +116

   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +447

   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +83

   EPiServer.Global..ctor() +76

   ASP.global_asax..ctor() +5

 

[TargetInvocationException: Exception has been thrown by the target of an invocation.]

   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0

   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113

   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232

   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83

   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1122

   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +128

   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +18

   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60

   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +260

   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

 

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]

   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930872

   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101

   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

I think I got the hang of what has happend, EPi VS addon created the database SQL_Latin1_General_CP1_CI_AS, then I just out of old habit didn't check that and put Finnish_Swedish_CI_AS when creating an empty database in Azure.

I would still consider this a bug in the update scripts.

I'll post an update if I can solve it without migrating to a new Azure database.

Get RolePermission data

$
0
0

[Working on Episerver version 10]

I am working on a Gadget for our system administrators that will show given role x, which permissions that role has.  The string to be translated to fetch the access permission is located in the dbo.RolePermission table in Epi Commerce database.

What is the best way to retireve the data from this table in code?

Error when rending ContentArea property inside a block

$
0
0

I feel I may be going the wrong way about this, but I have a block that I want to be able to put many images into one place. I defined a property of type ContentArea and restricted it to only allow images. Is this the best/recommended way to allow multiple images? The problem I am running into is trying render the images. If I use either Html.PropertyFor or Html.DisplayFor, both return this error:

The model item passed into the dictionary is of type 'EPiServer.Core.ContentArea', but this dictionary requires a model item of type 'GLHOMES.Website.Features.ShowcaseBlock.ShowcaseBlock'

Do I need to use a view model to load the content referenced in the ContentArea first, and and render them from that? Is this the right approach to support multiple images in a single property? Would IList<ContentReference> work better?

PartialFields in request, limiting fields on nested objects

$
0
0

Hey!

I'm trying to build a way to do projections without having to call .Select() on a query. Just adding to the Fields array on the request body works nicely. But in some cases a property is a list of objects, and I'd like to be able to limit the fields sent back from such entities.

But I can't quite figure out how. From what I can tell the built-in projections using .Select() generates an include of "FieldName.*" no matter which nested fields are used in the mapping.

Is this possible to do?

Issue with razor views while developing custom add-on

$
0
0

I've come across an issue while creating a custom MVC add-on. I have managed to find work-arounds to get it working but it would be useful to know if I'm doing anything wrong or missing anything.

I have created an MVC GuiPlugin but I seem to have issues with Episerver recognising referenced namespaces in the razor views. As far as I can tell, the issue seems to be that Episerver is ignoring the web.config in the root of my view folder.

  • If I use @model syntax, I get the error "the name 'model' does not exist in the current context". Workaround is to use @inherits System.Web.Mvc.WebViewPage instead
  • Using html helpers such as @Html.HiddenFor gives throws an error too, unless I explicitly reference the library at the top of the view e.g. @using System.Web.Mvc.Html

This is the web config for my Views folder https://github.com/zone/Zone.Episerver.PropertyViewer/blob/develop/src/Zone.Episerver.PropertyViewer/Views/web.config

Is there anyway to get Epi to recognise the referenced namespaces so I can write razor views in a more standard way?

Best practice for troubleshooting 100% CPU on EPiServer site?

$
0
0

Hi!

We're currently experiencing intermittent CPU spikes on one of our EPiServer sites.

Can anyone share some best practices when troubleshooting these problems?

I've tried LogParserStudio for IIS logs and DebugDiag for memory dumps, but with no luck.

Is WinDbg the way to go or some 3rd party application?

CollectionEditorDescriptor does not show value of calculated field in table after adding new record

$
0
0

In my project, we have a field using IList<Item> in a page type, we have an issue when we edit a page using this page type:

When I add a new value to IList using CollectionEditorDescriptor:

The value of Label is not showed after clicking Add button:

But after refreshing this page, the value of Label is shown again.

My implemtation for this field is:

Page type: StartPage.cs

[ContentType(
    GUID = "19671657-B684-4D95-A61F-8DD4FE60D559",
    GroupName = Global.GroupNames.Specialized)]
public class StartPage : PageData
{
    [Display(
	GroupName = SystemTabNames.Content,
	Order = 320)]
    [CultureSpecific]
    public virtual ContentArea MainContentArea { get; set; }
    [Display(
	GroupName = SystemTabNames.Content,
	Order = 321)]
    [CultureSpecific]
    [BackingType(typeof(PropertyItem))]
    public virtual IList<Item> Items { get; set; }
}

Item.cs:

public class Item
{
	public virtual string Text { get; set; }
	public virtual string Label
	{
		get
		{
			return "Label of " + Text;
		}
	}
}

PropertyItem.cs:

[PropertyDefinitionTypePlugIn]
public class PropertyItem : PropertyList<Item>
{
	protected override Item ParseItem(string value)
	{
		return JsonConvert.DeserializeObject<Item>(value);
	}
}

ItemEditorDescriptor.cs:

[EditorDescriptorRegistration(TargetType = typeof(IList<Item>))]
public class ItemEditorDescriptor : CollectionEditorDescriptor<Item>
{
	public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
	{
		base.ModifyMetadata(metadata, attributes);
	}
}

Notice: This issue happend after upgrading to Episerver CMS 11. In Episerver CMS 10, no issue.


Content type incorrect in application (EPiServer.Core.TypeMismatchException)

$
0
0

Hi,

Version: Commerce 11.8.5
Setup: Admin, front1, front2, front3

We had an (2, technically) incident where all the content (Products, Variants, Categories...) in Commerce reverted back to its core implementation: Castle.Proxies.ProductContentProxy (etc) instead of our custom implementation, giving us EPiServer.Core.TypeMismatchException all over the place. Perhaps notable is that only Admin & Front3 seems to have been affected.

This was not preceeded by an IIS reset, App Pool Recycle or anything else that I can find in the System/Application logs; everything looks fine as far as I can see (checked around the time of the first occurance of the error +- a couple of hours.

The database looked fine which made us perform an IIS RESET which fixed the issue, however a lot of damage was already done by the time we realized the issue. 

I'm just wondering if this is something known, our best guess is that it might be a bug in EpiServer. I haven't been able to find any details on issues that matches our issue on the forum, or anywhere else for that matter.

Timeline:
Deployed 11.8.5: 2018-08-15
...
First occurace on front3: 2018-09-08 23:37
Fixing IIS reset: 2018-09-09 22:20
...
First occurance on admin: 2018-09-12 13:33
Fixing IIS reset: 2018-09-13 09:21

These are the only occurances.


Any ideas are appreciated.
Thanks,
Fredrik

Table [tblNotificationSubscription] grows and causes high load on SQL server

$
0
0

Hi,

After upgrading to EpiServer CMS 11 lately (1.5 month ago) we have started to get SQL performance problem on our production servers.

The SQL statement causing this seems to be:

SELECT @SubscriptionCount = COUNT(*)
FROM [dbo].[tblNotificationSubscription]
WHERE UserName = @UserName AND SubscriptionKey = @key And Active= 

These requests happends often and the average time was ~13 seconds.

When i looked in [tblNotificationSubscription] it contained ~ 2.5 million rows and was growing.

We cleared the table and the SQL performance problems where gone.

Now five days later the table contains 250k rows and is growing fast.
We don't have any performance problem yet but I guess they will be back.

I can se that rows are added to the table everytime an editor is visiting a page in edit mode.
Is that the correct behaviour?
Our site has multiple scheduled jobs which modifies the content and I think that this also adds rows to this table.
These jobs is running as a specific user and almost 99% of the rows in the table has this UserName.

Does any one know if this is a bug or if there is something we can do to handle this?
Is it possible to disasble notofocations for a specific user or in a scheduled job?

What is the purpose of this table?

/Erik Jonsson 

EPiServer is not logging error when deployed in IIS server?

$
0
0

EPiServer is not logging error when deployed in IIS server? There is no log file in App_Data folder.

How to show "Code" in Commerce Catalog view?

$
0
0

Hi guys, 

Anyone knows how should I do the display the values of "Code" in Commerce Catalog view? In Commerce Manger I can see the values. 

Best regards, 

ChiChing

Custom selection factory populated with values from category repository

$
0
0

We've created a custom selection factory for retrieving parent categories (i.e. categories with children, regardless of what their own parent category are) from the category repository. The list is rendered - ok (first image) The value is set - ok (second image - we can also tell the value is set from debugging and because the values are rendered in the view). But, when the block that has this selection factory is published, the selected value in the dropdown list appears empty (third image), although the value is set. Anyone experienced something similar and know to solve it?

The selection factory:

    public class MainCategorySelectionFactory : ISelectionFactory
    {
        private Injected<CategoryRepository> CategoryRepository;
        public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            var categories = CategoryRepository.Service.GetRoot().Categories;
            var str = string.Empty;
            var list = new List<Category>();
            var strings = new List<string>();
            var selectableCategories = GetCategoriesWithChildren(categories,str, strings, list)
                .Select((x, i) => new SelectItem
                {
                    Text = strings[i],
                    Value = x.ID
                });
            return selectableCategories;
        }
        private string GetCategoryDescriptionAndAncestors(Category cat, string str)
        {
            return cat.Parent.Name != Category.RootName
                ? str + " - " + cat.Description
                : cat.Description;
        }
        private List<Category> GetCategoriesWithChildren(CategoryCollection categories, string str, List<string> strings, List<Category> list)
        {
            foreach (var cat in categories.Where(x => x.Categories.Any()))
            {
                // Add current category and its ancestor path to lists
                list.Add(cat);
                strings.Add(GetCategoryDescriptionAndAncestors(cat, str));
                GetCategoriesWithChildren(
                    cat.Categories, 
                    GetCategoryDescriptionAndAncestors(cat, str), 
                    strings, 
                    list);
            }
            return list;
        }
    }

The model:

        [Display(
            GroupName = GroupNames.Content,
            Order = 10)]
        [SelectOne(SelectionFactoryType = typeof(MainCategorySelectionFactory))]
        public virtual string MainCategory { get; set; }

What am I missing?

Modify Commerce backoffice catalogue search? [12.6]

$
0
0

Hi!

I Episerver you can search the catalogue. It gives you maximum 4 hits.
Is there anyway to modify this internal search? Both to give you more than 4 hits and to show more data?

Thanks!

/Kristoffer

Shipment Lineitems

$
0
0

Working on the latest version on Epi/Episerver Commerce.

I am having to create some custom reports for our client. One of the reports requires the following:

  • PO Number
  • Date of order
  • Warehouse
  • Delivery status
  • Payment status
  • Total (item cost in £s)
  • Postage (in £s)
  • Gross (Total + postage)
  • Refunds (in £s)

Each order can have split shipments, so different warehouses (stores) fulfilling orders. Looking at the database schema  https://world.episerver.com/globalassets/sdkdocuments/developers-guide1/episerver-commerce/75/orders/ordersystem.png

I can't see any direct relationship between shipment and lineitem tables. As warehousecode in the LineItems table is now obsolete we would now have to use the Shipment table to find out the warehouse/store.

So the question is, at a database level, how can I found out which split shipment is shipping which lineitem so I can work out which warehouse/store is dealing with that lineitem.


EpiServer DXC and Azure Web Service now supports custom culture

$
0
0

As per the new release from Microsoft, Azure now supports custom culture. 

Here are few links

https://blogs.msdn.microsoft.com/appserviceteam/2017/03/07/custom-cultures-coming-soon-to-azure-app-service/

Here is how you create a new culture and register it.

https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Globalization/Adding-languages/ 

Remember, you might see some errors while registering the new culture, errors are related to "UnauthorizedAccessException". Please follow this article to find resolution:

http://www.malaysiasky.net/iis-windows-globalization-permission-denied/ 

Issue whith TinyMCE 2 and inline blocks

$
0
0

We have problem with Tinymce : when you drop a block in a XHTML it has div tags around it even if the block in view mode is only showing a value.

Tinymce adds p tag around witch results in wrong html for the property.

I managed to add a setting to tinymce but it's only working when the editor drops the block.

When editing a xhmtl with a block in it, Tinymce changes the html despite the setting:  .AddSetting("valid_children", "+p[div]") .

Has someone managed to solve the problem with block div in p tags in xthml properties?

StackOverflowException thrown from Promotion Engine on cart.applydiscounts()

$
0
0

Hi

I'm receiveing a System.StackOverflowException when calling cart.ApplyDiscounts(). Any ideas why? I'm not getting any other details in the exception. This is literally breaking my site, if user has an open cart.

Regards

Ritu

Component ClientResources Path

$
0
0

Hello,

I have been banging my head against the wall for a while now trying to figure out what I am doing wrong here. I am trying to package my dashboard component, but when I try to reference the dojo script, it throws a 404 because it is looking in the ~/Episerver/Shell/{version}/ folder instead of my packaged component folder. Looking at the component package it all seems to be structured correctly in ~/modules/_protected/{package_name}. I am assuming its something I am doing wrong with my module.config but I can't seem to narrow it down.

<?xml version="1.0" encoding="utf-8"?><module productName="componentName" clientResourceRelativePath="1.0.9" loadFromBin="false" tags="EPiServerModulePackage"><assemblies><add assembly="company.componentName" /></assemblies><dojo><paths><add name="componentName" path="ClientResources/Scripts" /></paths></dojo><clientModule><moduleDependencies><add dependency="Shell" /><add dependency="CMS" /></moduleDependencies></clientModule></module>

Can anyone point me in the right direction?

Thanks

Issue with CMS Import over witting values in one language over another language

$
0
0

Hi

We are doing some consilidation of 2 different installations where we now import content from one site to another.

  1. First we import all pagetypes with "en" as the only lang to import, just so we can preview the outcome before importing all langs
  2. Second we want to import "sv":
    1. We tick the "Update existing content items with matching ID" box
    2. We choose same location
    3. We select "sv"

BUT the strange thing now is that "sv" is indeed added with correct value BUT "en" is also updated with the values from the swedish translation:

Does anyone have any clue on how this behaviour is caused?

EPI CMS version 11.3.1

Viewing all 6894 articles
Browse latest View live