Wednesday, November 16, 2011

DNN6 localization duplicate key error

I have started using DNN6 and the localization facilities of DNN. My first effort was a 5-language site.
After installing the language packs, I hit the 'localise content' button and waited for the initialisation to take place.

The process stuck for two of the languages in the first page. This resulted to only one page displayed as localised in the localisation table. When trying to add a new page, localised in all languages I got the following error:


DotNetNuke.Services.Exceptions.ModuleLoadException: An item with the same key has already been added. ---> System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) at DotNetNuke.Entities.Modules.ModuleInfo.get_LocalizedModules() at DotNetNuke.Entities.Modules.ModuleController.LocalizeModule(ModuleInfo sourceModule, Locale locale) at DotNetNuke.Entities.Tabs.TabController.CreateLocalizedCopy(TabInfo originalTab, Locale locale) at DotNetNuke.Entities.Tabs.TabController.CreateLocalizedCopies(TabInfo originalTab) at DotNetNuke.Modules.Admin.Tabs.ManageTabs.SaveTabData(String strAction) at DotNetNuke.Modules.Admin.Tabs.ManageTabs.cmdUpdate_Click(Object Sender, EventArgs e)

I thought the problem had to do with the localisation inisalisation going wrong but it wasn't.
It was actually a module that caused the problem. I had this module on a page with the 'show on all pages' setting checked. This somehow caused the module to be placed multiple times in the new pages.
After deleting the pages and trying to add a new one all over again the problem still existed.

Finally, I checked the database tables and saw that the module in table TabModules was linked with tab-ids that did not longer exist. I deleted these records and disabled the 'show on all pages' option. Adding a new page in all languages worked like a charm afterwards!

Quick summary:
Problem: Adding new page in multiple languages doesn't work due to Duplicate key error
Solution: Check if module with 'show on all pages' on exists and disable the option. Check the the TabModules table for module ids connected with tab ids that no longer exists. (in reference with the Tabs table)




Wednesday, July 13, 2011

Deploy WCF service on IIS -7.5 (HTTP Error 404.3 - Not Found)

After developing a number of RESTful services using WCF, I wanted to deploy my services to IIS 7 (WIN 7 )and not only use the Visual Studio internal test server. Btw, I found this post extremely helpful to get REST with WCF working.

After creating the application to IIS I got this page


The solution was to simply run a script found in this post by Guy Burstein. It just runs afterwards!

P.S.Don't forget to restart IIS after running the script

Sunday, July 3, 2011

Adding another page in an artisteer skin for DNN

I start writing to this blog about ways to solve various problems that I meet during my work as a software and web developer. I don't claim my solutions to be the best out there, but when being in a situation where you are a step just before breaking your pc because Iexplorer wont render your website correctly or a property file in java cant't be loaded no matter what you do, then finding a solution that justs works might be simply what you want.

After that short intro, I'm posting about the last thing that made me spend 4 hours searching the solution the other day. I had added a new page in one skin that was generated by artisteer in a DNN website I am currently developing. Artisteer normally generates page.ascx and page-admin.ascx, the first for norma pages and the second for admin ones.

I added another one, 'platform.ascx' in order to change the layout of the panes. I copied 'page.ascx', made the changes and then loaded the skin in the DNN page. Firefox shows ok, Chrome ok but Iexplorer shifts all the elements to the left side! The problem was the doctype of the page. It was falling back to the default html 4 of the DNN (found in host settings).

The solution was to create a copy of 'page.doctype.xml' and rename it to platform.doctype.xml.
This way the page doctype was not rolling back to html 4  but stayed in XHTML 1.0.
Quick summary:
Problem: New page of DNN Artisteer skin doesn't show correctly in Iexplorer (7,8,9).
Solution: Don't forget to copy file page.doctype.xml renaming it to the same name as the new skin page



P.S. As seen from the above, I am mainly involved with DNN websites. I also play around with JQuery and java so my posts will be around these technologies.