An error occurred while attaching module (Dynamicweb.Frontend.Content)

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
   at Dynamicweb.Data.Database.CreateConnection()
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductById(String productId, String productVariantId, String productLanguageId)
   at Dynamicweb.Ecommerce.Products.ProductService.FetchMissingProductsInternal(IProductRepository repo, IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key)
   at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, User user, Boolean showUntranslated)
   at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, Boolean useAssortments)
   at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, Boolean useDefaultLanguage)
   at Dynamicweb.Ecommerce.Frontend.Frontend.EcomRender()
   at Dynamicweb.Ecommerce.Frontend.Frontend.GetContent()
   at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20

Error executing template "/Designs/Rapido/Paragraph/SpProductContentArea.cshtml"
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
   at Dynamicweb.Data.Database.CreateConnection()
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductsBySql(CommandBuilder query, Boolean doRefactoring, Boolean bulkFill, Boolean useAssortments)
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductsByNumber(String productNumber, String productLanguageId, Int32 limit)
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductByNumber(String productNumber, String productLanguageId)
   at Dynamicweb.Ecommerce.Products.ProductService.GetProductByNumber(String productNumber, String productLanguageId)
   at CompiledRazorTemplates.Dynamic.RazorEngine_dfb9fcc4a9804cff8ec06e093703fc25.Execute() in E:\Webdata\www.kruuse.com\Files\Templates\Designs\Rapido\Paragraph\SpProductContentArea.cshtml:line 13
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20

1 @using System.Web; 2 @using System.Text.RegularExpressions; 3 @using Dynamicweb; 4 @using Dynamicweb.Core; 5 @using Smartpage.CookieManager; 6 7 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8 9 @{ 10 var productid = HttpContext.Current.Request.QueryString.Get("ProductID"); 11 if (!string.IsNullOrEmpty(productid)) 12 { 13 var product = Dynamicweb.Ecommerce.Services.Products.GetProductByNumber(productid, true); 14 if (product != null) 15 { 16 var productContentAreaId = Converter.ToInt32(Regex.Match(Converter.ToString(product.ProductFieldValues.GetProductFieldValue("SpProductContentAreaPageId").Value), @"\?Id=(\d+)").Groups[1].Value); 17 var paragraphs = productContentAreaId > 0 ? Dynamicweb.Services.Paragraphs.GetParagraphsByPageId(productContentAreaId) : null; 18 if (paragraphs != null) 19 { 20 foreach (var paragraph in paragraphs) 21 { 22 var cookieBot = new CookieBot(); 23 if (!cookieBot.Marketing) 24 { 25 Dictionary<string, string> oldItemStuff = new Dictionary<string, string>(); 26 Dictionary<string, string> itemStuff = new Dictionary<string, string>(); 27 foreach (var item in paragraph.Item) 28 { 29 if (item.Value != null && item.Value.ToString().Contains("<iframe")) 30 { 31 var iframes = Regex.Match(item.Value.ToString(), "<iframe[^>]*?(?:\\/>|>[^<]*?<\\/iframe>)"); 32 if (iframes.Success) 33 { 34 if (Dynamicweb.Context.Current.Session["SpCookieBotIframes" + paragraph.ID] != null) 35 { 36 oldItemStuff = (Dictionary<string, string>)Dynamicweb.Context.Current.Session["SpCookieBotIframes" + paragraph.ID]; 37 } 38 39 foreach (Group iframeItems in iframes.Groups) 40 { 41 oldItemStuff.Add(item.Key, iframeItems.Value.ToString()); 42 43 string itemTypevalueNoIframe = item.Value.ToString().Replace(iframeItems.Value, ""); 44 itemStuff.Add(item.Key, itemTypevalueNoIframe); 45 } 46 47 if (oldItemStuff.Count > 0) 48 { 49 Dynamicweb.Context.Current.Session["SpCookieBotIframes" + paragraph.ID] = oldItemStuff; 50 } 51 } 52 } 53 } 54 55 foreach (var item in itemStuff) 56 { 57 paragraph.Item[item.Key] = item.Value; 58 } 59 } 60 else 61 { 62 if (Dynamicweb.Context.Current.Session["SpCookieBotIframes" + paragraph.ID] != null) 63 { 64 foreach (var item in (Dictionary<string, string>)Dynamicweb.Context.Current.Session["SpCookieBotIframes" + paragraph.ID]) 65 { 66 paragraph.Item[item.Key] = item.Value; 67 } 68 69 Dynamicweb.Context.Current.Session.Remove("SpCookieBotIframes" + paragraph.ID); 70 } 71 } 72 73 @RenderParagraphContent(paragraph.ID) 74 } 75 } 76 } 77 } 78 }