Quantcast
Channel: Sitecore basics!
Viewing all 178 articles
Browse latest View live

How I learnt Sitecore MVC?

$
0
0

Challenge:

Before few months back. I started delving in to Sitecore MVC. Before that I knew basics of it. But no hands on. As I was busy with launching other site. Initially when I searched I found the lot of articles and blogs which scared me! You too?! Google can give you results. But which are best and which are not. You can find it out either trying or finding out other folks who already tried and provide good articles. So, while working I took some notes and I promised my self that once I am done I will share with you. So, you may get benefited out of it.

Sounds interesting? You are also searching for something like that? Then go ahead..!

Solution:

As per my practice. I started understanding ASP.NET MVC. Because i always believe in starting from basics. And following links helped me to do so:

  1. http://www.asp.net/mvc/overview/getting-started/recommended-resources-for-mvc
  2. http://www.asp.net/mvc/videos/pluralsight-aspnet-mvc-5-fundamentals
  3. https://mva.microsoft.com/en-US/training-courses/introduction-to-asp-net-mvc-8322?l=nKZwZ8Zy_3504984382
  4. http://www.w3schools.com/aspnet/mvc_intro.asp
  5. http://www.asp.net/mvc/overview/getting-started/mvc-learning-sequence
  6. https://msdn.microsoft.com/en-us/library/dd381612%28v=vs.100%29.aspx
  7. https://msdn.microsoft.com/en-us/library/dd381412%28v=vs.100%29.aspx

Then moved to Sitecore MVC:

  1. http://www.sitecore.net/learn/blogs/business-blogs/technical-trends/posts/2012/06/mvc-and-sitecore-651-overview.aspx
  2. http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2015/02/how-is-sitecore-mvc-different-from-aspnet-mvc.aspx
  3. https://sdn.sitecore.net/upload/sitecore7/72/sitecore_mvc_developer_guide_72-a4.pdf
  4. http://sitecore-community.github.io/docs/sitecore-mvc/
  5. http://sitecore-community.github.io/docs/sitecore-mvc/creating-project/
  6. http://www.joe-stevens.com/2014/08/17/sitecore-mvc-tutorial-creating-your-first-sitecore-mvc-website/
  7. https://github.com/Sitecore-Community/sample-sitecore-mvc

I liked following excerpt from Lars – Especially RCMV and this diagram!

MVC stands for Model, View and Controller, though I have never understood the order of the abbreviation (by my limited intellect, RCMV would have been more appropriate, with a Route being a significant part of the equation).
Essentially, the request lifecycle of MVC is a Route (usually something that parses the http request) points to a Control (some .net code) which generates a Model (object), which is parsed by a View (usually a Razor view).
MVC Request Lifecycle
This approach is distinctly different from Web Forms, because it requires more code plumbing to create the page, and with less automated code reuse. On the other hand, the developer has more rigid control of the code executed on the page, and the data delivered to the output. Also, not to forget, MVC makes unit testing easier as (most of/all) the code usually is executed in the controller part of the lifecycle.

In my opinion, MVC is well suited for web sites with application functionality (e.g. HTML 5 applications).

Okay, enough theory. I know you developers!:-) We need some action now. So, thought to look for some quick start application tried lot of things. But few things were out dates or not properly documented. Finally Martina’s video helped me to give a hands on. I strongly recommend you to follow exercise given in tutorial. It will give you good hands on experience. Which will boost your confidence and clarify your concepts a lot!

I faced some challenges in quick start. But life is NULL without challenge. And your best learnings come out of a challenging situation only. Here are few blog posts helped me to come out of it:

  1. http://sitecoreskills.blogspot.in/2014/06/preparing-sitecore-72-and-mvc-in-visual.html
  2. http://www.seanholmesby.com/fixing-visual-studio-intellisense-in-sitecore-mvc-views/ – Especially for Intellisense
    1. If you are using Project and Webroot model then make sure you copy web.config from Sitecore root to project
    2. Make sure Sitecore.MVC is there in reference
    3. Sitecore.MVC and Sitecore.Kernel – Is Copy Local  true
    4. Or final resort copy all webroot/bin assemblies to project/bin
  3. http://stackoverflow.com/questions/24147846/system-web-webpages-html-htmlhelper-does-not-contain-a-definition-for-sitecor/24152053#24152053

MVC is fun! It is like Maths — Once you understand it. You would like to do it again and again!

Further reading:

  1. http://blog.alen.pw/2012/08/learning-sitecore-mvc-part-1.html
  2. http://blog.alen.pw/2012/08/learning-sitecore-mvc-part-2.html
  3. http://www.matthewdresser.com/sitecore/moving-to-sitecore-mvc
  4. http://techitpro.com/sitecore-mvc/http://www.dotnet-tricks.com/Tutorial/mvc/a9P1010113-MVC-Areas-with-example.html
  5. http://www.codeproject.com/Articles/714356/Areas-in-ASP-NET-MVC
  6. https://community.sitecore.net/developers/f/8/t/108s
  7. https://sitecore.unic.com/2015/06/24/the-sitecore-mvc-puzzle
  8. https://github.com/Sitecore-Community/sample-sitecore-mvc

Have I missed something? Where are your MVC notes? Would you like to share it with others?

Happy Learning!


Filed under: Latest, Sitecore, Tips and Tricks Tagged: MVC

Unable to see components on Stats.aspx page for your Sitecore 8 MVC site?

$
0
0

Challenge:

We are near to launch one of our new site. Built on Sitecore 8.1 U1 and MVC, GlassMapper, TDS etc. As per our practice we applied HTML caching on all possible components. Which we were verifying whether it is working as per expectation or not. One of the way to do is using stats.aspx page. But when we opened it. It was displaying only one component — VisitorIdentification — Which is more of a Sitecore control. Then what happened to all our renderings? Same with you? Or you would like to be proactive? And eager to know what it was. Then this post is for you. Let’s delve in to it.

Solution:

As expected. We did a quick Google search and came across of this blog : https://blog.wesleylomax.co.uk/2015/11/20/sitecore-8-mvc-custom-site-not-showing-stats-aspx-page/

Two things came out from this blog post:

  1. This guy was unable to see his sites, where I was able to see site. But not renderings
  2. Required files were not attached.

Again, as expected. Raised Sitecore support ticket and they accepted it as BUG and provided Hot fix:

To fix the issue, please consider deploying the following patch:
1. Copy the attached Sitecore.Support.398176.dll assembly to the ‘\bin’ folder.
2. Copy the attached Sitecore.Support.Mvc.Statistics.config file to the ‘\App_Config\Include’ folder.

If there are any issues with this patch, please let us know. More information about Sitecore patches can be found here: https://kb.sitecore.net/articles/077333

To track the future status of this bug report, please use the reference number 94421. More information about public reference numbers can be found here:
https://kb.sitecore.net/articles/853187

Files can be downloaded from here :https://goo.gl/18BGgV

It worked? Awesome!

So, what was the issue? I am glad you are still reading. Lot of folks might have closed for the day. But I appreciate yo being curious to ask basic question “Why?”. Let me share what I understood:

  1. It looks recording stats information was not done for MVC pipeline or it might have been done at wrong place which was not working – Sitecore guys know it better. I am just assuming it here
  2. There are two IMP. pipeline in MVC <mvc.renderPlaceholder> and <mvc.renderRendering> where this guys have hooked code for recording that information e.g.    Statistics.AddRenderingData(…)

Special thanks to Pushpraj Ruhal (Sitecore support) guy who worked on this issue


Filed under: Caching, Sitecore, Sitecore Bugs, Tips and Tricks Tagged: Caching, HTML Caching

Configuring Web Deploy on your Sitecore server

$
0
0

Challenge:

Last week one of my mates was trying to configure Web deploy with Build server and CM/CD Server and they were facing some challenges to get it done. We have done it so many times in the past. But as we haven’t had it documented we set together and fixed it. But then I promised to blog it and here you go!

Solution:

Microsoft folks have already written nice documentation here : http://www.iis.net/learn/install/installing-publishing-technologies/installing-and-configuring-web-deploy-on-iis-80-or-later

This document is quite huge I know and in this fast paced world. Who has time to read through all that document. So, you are looking for important steps? Here are those:

  1. To install : Refer section :”Using the Web Platform Installer to install Web Deploy Separately”
  2. To configure : Refer section : “Configuring a Site for Delegated Non-Administrator Deployment”

That’s it!

You are facing challenge with your Web deploy configuration? Feel free to get in touch with me. Because I have spent good amount of time troubleshooting it (and before that understanding it) and this post is proof of it.

Happy Deployment!🙂

 


Filed under: Sitecore, Tips and Tricks Tagged: Deployment, Sitecore, Web Deploy

Inheriting Sitecore Site Properties with Sitecore Patching and Transformation

$
0
0

Challenge:

Sitecore is such a huge platform that every day you find something new and interesting. Happens with you as well? It is happening with me since last 7+ years!😉 But I am enjoying learning it and then sharing it with you.

So, let’s say you have one site node defined with all basic things e.g. enablePreview, enableWebEdit, hostName, startItem, database etc. It has hostName as “www.scbasics.com”. Now you would like to have one more site where you would like to use base attributes as earlier defined and you would like to modify few attributes only:

<sites>
  <site name="site1" virtualFolder="/sitecore/admin" physicalFolder="/sitecore/admin" enableAnalytics="false" domain="sitecore" loginPage="/sitecore/admin/login.aspx"/>

  <site name="site2" inherits="site1" />
  <site name="site3" inherits="site1" domain="extranet" />
  <site name="site4" inherits="site1" enableAnalytics="true" />
</sites>

Source : http://sitecoreskills.blogspot.com/2014/08/inheriting-sitecore-site-properties.html

I also did the same and it worked in local. But when I deployed it on QA/Dev server. It was not working. After spending sometime learnt something which I would like to share with you as well. You might see it in future or might be already facing it and reading this blog to find a way!🙂 Let’s go!

Solution:

As you would have done, I also did showconfig.aspx on server and then noticed that my site2 was getting added before site1 and that was causing this issue and it was happening because I was using SlowCheetah Transformation and inserting site2 based on environment. To fix it — I used patch:after=”site[@name=’site1′]” which fixed this issue. Here is how it looks new with transformation

<sites>
  <site name="site2" inherits="site1" patch:after="site[@name='site1']" xdt:Transform="Insert" hostName="site2.com" domain="extranet" enableAnalytics="true"/>
  <site name="site3" inherits="site1" domain="extranet" />
</sites>

Good read :

http://sitecore.unic.com/2014/08/08/enable-multi-level-site-property-inheritance

https://sitecoreclimber.wordpress.com/2015/10/31/how-to-set-up-a-multi-site-solution/

Happy Patching!🙂


Filed under: Sitecore, Tips and Tricks Tagged: Multisite

New Module : Sitecore Mongo Shell

$
0
0

Challenge:

For few projects, I noticed that me and few of my colleagues/friends had issue validating weather Mongo connection is right or not, and if yes whether data is going through or not. Mongo Client tools (e.g. Mongo Management Studio) are there. But what If you can’t install Mongo Client Tool on server and Firewall is blocked to open Mongo connection out of network?

This tool will help you for that!

Basically, this tool is inspired from. SQL Shell – Sitecore tool to query SQL Data, https://github.com/SitecoreSupport/TestMongoDBConnection

BIG Thanks to them.

Solution:

This is how it looks :

2- 2016-08-28 18_29_23-Mongo Shell Tester - BETA 3 - 2016-08-28 18_29_50-Mongo Shell Tester - BETA 2016-08-28 18_28_27-Mongo Shell Tester - BETA-1

This is how it works :

Mongo-Shell-Beta-Demo

Have submitted to Marketplace for review. So, will share link once it is available. But I was eager to share [and I am sure you are eager to use] this with you. Package/Source code/Documentation everything is here : https://klpatil.github.io/SC-82-Demo/

Happy Mongo Troubleshooting!🙂


Filed under: Sitecore, Tips and Tricks, Tools

Sitecore MVP Summit and Symposium basics from the field

$
0
0

Hey Sitecorian, I’m sure you must have been seeing lot of Buzz about Sitecore MVP Summit and Sitecore Symposium which was happening at NOLA.

This was my second Sitecore event. First one was at Dreamcore Europe in 2011. This one was lot different than last one. Especially, Because of two things:

  1. Sitecore community has grown a lot!
  2. Sitecore is taking this event at a bigger scale – Thanks to their event committee!

So, luckily I was part of this event. Thanks to Horizontal Integration for sponsoring us. 30 people from HI were there. As THIS IS OUR DOMAIN:

https://i1.wp.com/www.horizontalintegration.com/-/media/hi-landing-pages/sitecore-symposium-landing-page/symposium_landing_hero.jpg

It was a great event. Full of information, which will take sometime for me to digest. I took a lot of notes. And I thought to blog and share with you as well. So, If you might have missed this event. Because of any reason – No Visa, Lack of finance, Other plans, Family reasons, or anything else. Then this post is for you.

Again, event was full of experience. And I won’t be able to share same experience with you e.g. We did Go-Karting, Been on boat etc. — That thing I can’t share. But i can surely share knowledge and I am sure you will feel that experience via  this article:

Media images

  • Sitecore MVP Summit : MVP Summit happens every year to appreciate all MVP efforts. Sitecore demonstrates new things first hand to MVPs/VIPs🙂 Lot of MVPs and Sitecore employees reached here on Sunday night and they were chatting till early morning Monday — That’s what happens when passionate people gets connected. Monday — It started with registration and Keynote. Followed by lot of sessions. And in evening we went on boat — Awesome experience! Second day we went to NOLA Motorsports — We had sessions there, Round table discussions and finally we did Go-Karting. Few pictures:
Click to view slideshow.

Inspired? Want to become MVP? Start learning and start sharing. This article might help you

  • Sitecore Symposium : MVP Summit is only for MVPs. But Symposium is for everyone. For Partners – To show their potential and connect with future clients, Developers and Marketing folks to connect with each other, And everyone presents their learnings. This event also started by Welcome reception and registration first day then second day a Keynote from Michael Seifert with a new experience and demand more theme. Followed by back to back sessions and big party at House of Blues. Second day was also full of learnings. Few pictures:
Click to view slideshow.
Topic Basic How it affects you? Remark
Developer Marketing/

Business

Future of Form  Something new coming up in Forms You should be aware of this  This will way you work with Forms

 

 Unfortunately, can’t share lot on this as it is under MVP NDA
Commerce Future It will be known as Sitecore

 

Commerce

Engine is built on .NET Core

If you are looking for E-Commerce with Sitecore then you must need to check this

Same as last column

Very configurable – Commerce engine on .NET Core
Idea Management If you have any idea to improve Sitecore. Post it here: https://sitecore.uservoice.com/ Sitecore Product team will funnel it using Prod Pad If your wish list/idea gets voted – It has higher chance to get it done You can also post One more example of Sitecore listens!
Nuget Sitecore assemblies are available on Sitecore Nuget : Better to use nuget.config and commit in repository along with .sln file

Avoid using references

NA NA
Sitecore on Azure Lot of great things coming up. Removing Azure module. Support for ArmViz Templates, Support for Redis,

 

Just a note: MS is sun setting Cache extensions soon. So, if you have Cache worker role and using session. You need to upgrade or find alternative

You will not need Azure Module. You can directly publish on Cloud Services from Visual Studio

 

You will be able to CM/CD/AG/Processing server on cloud with few clicks and few minutes

If you are setting up new servers. You should check this Coming in Sitecore 8.2 Update1
Sitecore DI Microsoft DI is support is available out of the Box with Sitecore 8.2 Look for some configurations and attributes like resolve=”true”

 

There is also an Admin page to look at DI : ShowServicesConfig.aspx

For bigger projects – Ask for DI for highly loosely coupled and easy to maintain projects NA
.NET Core Sitecore is adopting .NET Core a lot. And so as community. It is time for you to learn .NET Core

 

They did it using Publishing Service in Sitecore 8.2

 

They have plans for lot of other things

   
Habitat/Helix One thing you need to carve in your mind “Habitat is a demo site, and Helix is Sitecore standards way to do things”

 

Another way :

Helix is a specification and Habitat is an implementation

Finally, Sitecore came up with documentation which talks about Standards. Because Sitecore is like Weapon. You can use it for your safety or you can harm other using it. It’s how you use it. Ask your developers to read Helix Standards You can also contribute – It’s on Github!
Path Analyzer Alex and Adam did a great job! Now, you don’t need Silverlight to view Path Analyzer – They ditched Silverlight – Sitecore 8.2

 

Awesome way to analyzer user’s path

 

New UI

It’s 100% on JS – Using React, Redux, Modular JS,  D3.JS,  Web Pack Must use Path Analyzer to understand your customers NA
Sitecore Experience Accelerator (SXA) New way to Create Sitecore websites

 

Built on Helix principles

 

80% Faster Sites

 

Understands Tenants, Sites

You should surely know about this. Mainly it is for FED and Content authors Good to check If your Site design is simple and you would like to get things done faster. Just make sure you do maths on Licensing Not sure about licensing model. Does it make sense to get it done from Partner of from this module. Is not clear to me yet
Developer Keynote Sitecore is going in Cloud First, SOA and Stateless direction

 

 

Data Exchange Framework is coming up

 

OData will be standard Protocol for Sitecore – REST API and OData

 

Micro Services using ASP.NET Core

 

Express Migration Tool – Launched in 8.2 – It only does content – It is possible from 7.2 to 8.2

Keep watching these tools NA
xConnect Collect data Cross Channel

 

xDB will be central

Client API will be used You can use this data with Power BI as well Will come in 8.3 – Initial release

 

8.4 – Full version

Sitecore Publishing Service After 10 years – These are some of the biggest improvements happened in Publishing logic

 

Improves Publishing performance heavily. It uses Smart logic

 

New UX

Built on .NET Core

 

Needs to install module and configure few things

No new license required Launched in Sitecore 8.2

That’s it. These were my learnings from my views. If I missed any points. Feel free to let me know. Will be more than happy to add it. Read more:

So, now I’m back to my work with lot of things to learn, implement and share! This was my experience! – If you are customer DEMAND MORE and If you are a partner DELIVER MORE!

See you next year at Las Vegas!


Filed under: Sitecore Tagged: Learnings, MVP Summit, Sitecore, Symposium

Sitecore Content Testing not working?

$
0
0

Challenge:

We use Content Testing, A/B Testing a lot for all our clients. And you need to do that. Correct? Because that’s why they invested heavily in Sitecore license.

We were trying to enable it for one of our client as per this article : https://doc.sitecore.net/sitecore_experience_platform/analyzing__reporting/experience_optimization__content_testing/setting_up_tests/adding_content_testing_to_a_workflow

But it was not working. I got involved in this project later on. So, had no idea what’s going on. Spent sometime figuring out to make it work. And I think it will be good for you as well to know this. In case, you also face similar issues.

Solution:

We started looking at Solution and found one thing.  In past due to Performance issues in experience editor Sitecore folks asked us to disable Sitecore.ContentTesting.Requests.ExperienceEditor.SuggestedTestsCountRequest class to prevent excessive calls to database  [Sitecore.ContentTesting.Requests.ExperienceEditor.SuggestedTestsCountRequest class to return 0]. As we were on Sitecore 8.0 Update-2 we had to write our custom code. But it has been fixed in Sitecore 8.0 Update-3 (“The Experience Editor slowed down when there was a large number of Suggested Tests. This has been fixed. (434105)”) after analyzing a bit and having a Sitecore support discussion we thought this seems not be main reason for A/B Testing. But that was theory. Wanted to prove it.

So, Installed plain Sitecore on my local machine and configured Automated Test which was working! Then gradually started adding all configurations and custom code related to A/B testing in plain Sitecore and finally, Have been able to find out root cause. Eager to know? What it is? Let me share

Basically, When we did upgrade we were not using ContentTesting. So, we disabled it using our custom patch file:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="ContentTesting.AutomaticContentTesting.Enabled">
        <patch:attribute name="value">false</patch:attribute>
      </setting>
      <setting name="ContentTesting.GenerateScreenshots">
        <patch:attribute name="value">none</patch:attribute>
      </setting>
      <setting name="ContentTesting.PhantomJS.EnableJavaScript">
        <patch:attribute name="value">false</patch:attribute>
      </setting>
    </settings>
  </sitecore>
</configuration>

After reverting those attributes to Original it started working. Then we did some reading on those attributes and here’s what we learnt:

  1. ContentTesting.AutomaticContentTesting.Enabled : Determines whether automatic content testing features should be enabled.Default value: true
  2. ContentTesting.GenerateScreenshots : Determines when screenshots should be generated.Must be one of ( all | limited | none ) Default value: all. Basically, It takes screenshot of all possible variations
  3. ContentTesting.PhantomJS.EnableJavaScript : Determines whether the PhantomJS tool should allow JavaScript on pages. Default value: true

Here is the working config:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="ContentTesting.AutomaticContentTesting.Enabled">
        <patch:attribute name="value">true</patch:attribute>
      </setting>
      <setting name="ContentTesting.GenerateScreenshots">
        <patch:attribute name="value">all</patch:attribute>
      </setting>
      <setting name="ContentTesting.PhantomJS.EnableJavaScript">
        <patch:attribute name="value">true</patch:attribute>
      </setting>
    </settings>
  </sitecore>
</configuration>

P.S. Thanks to Eric. Who worked on this issue along with me and Thanks to Sitecore support team as well!

Happy Content Testing!🙂


Filed under: Performance, Sitecore, Tips and Tricks Tagged: AB Testing

MongoSessionStateProvider might slow down your application

$
0
0

Challenge:

Since couple of weeks, Have noticed some performance issues with couple of projects, I was involved. Basically their page load was taking 20 seconds to load and when you look at other things like:

  1. Sitecore log
  2. PublishQueue
  3. History
  4. EventQueue
  5. and so on

Everything seems normal. Then we figured out that we are using MongoSessionStateProvider for these clients and after doing some steps we have been able to load pages in normal load time! So, what we did to tackle the situation? What we learnt during this challenge? Curious to know? We are also curious to share. Here you go:

Solution:

First of all, If Session, SharedSession etc. Confuses you or scares you. Then don’t worry. You are not the only one in this Sitecore world. There are a lot of folks like you. And the best thing is someone already wrote simplified version of it for you – Thanks to Martina! Please read these awesome articles:

Let’s Talk About Session State

What’s in a session: What exactly happens during a session, and how does the xDB know who you are?

https://doc.sitecore.net/sitecore_experience_platform/81/setting_up__maintaining/xdb/session_state/session_state

Enough Basics. Let’s get back to main point. Live site pages were loading in 20 seconds and as it was slow LB was saying you guys [CD servers] are not healthy. I am not giving you any requests to serve. After doing basic check we thought we should take memory dump and analyze it. Dump revealed that Sitecore is waiting for Mongo to respond. So, we though to look in to Mongo DB and after clearing session collection from session and sharedSession Mongo DB. Things came back to normal.

You can do it using RoboMongo you can do it using UI.

2016-09-25-12_44_49-db-dev-test-sandboxes-db-sc-dev-test-cloudapp-net-remote-desktop-connec

But If you don’t have RoboMongo connection. Then you can do it using Mongo Shell Commands : https://docs.mongodb.com/manual/reference/mongo-shell/

  • show dbs
  • use <db>
  • show collections
  • db.sessions.drop()

Do it for both session and sharedSession database. That’s it!

Then thought to get views on this issue with Sitecore support ticket and during discussion found one BUG and some learnings which says it is good to use SQL Session State Provider instead of Mongo

Support discussion:

Support Team : If you use two different database, the Shared Session State provider might not create a required index on the session collection. As a results, a MongoDB instance can be high overloaded and start producing symptoms like in your case.

Using Robomongo tool, can you please check if there is the e_1__id.s_1__id.a_1 index in the session collection?

The index definition must look like below:

Name: e_1__id.s_1__id.a_1
Keys:
{
    “e” : 1,
    “_id.s” : 1,
    “_id.a” : 1
}
We : We found this index only on session database. It is there in Session and Not Shared Session DB. Do you want us to create it manually?
Support Team :
Yes, you must create the  e_1__id.s_1__id.a_1 index to avoid overloads of your MongoDB server. Otherwise, the Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider might put down the server when retrieving contact’s sessions for your web site visitors.

Using Robomongo tool, please add manually the index:

  • Name: e_1__id.s_1__id.a_1
  • Keys:
{
    “e” : 1,
    “_id.s” : 1,
    “_id.a” : 1
}
I have registered this issue as a bug in the current version of Sitecore. To track the future status of this bug report, please use the reference number 114604.
Support Team :  Sitecore Azure modules has been designed to work with xDB Cloud only. Technically, you can bring your own MongoDB server, Processing/Aggregation, Reporting Services and Search server and plug them in, but you have to do it manually, and then reconfigure Editing Farm as Content Management (CM) role and Delivery Farm as Content Delivery (CD) role. Otherwise, the module deploy configuration from a deployment center as is and a farm will behave as CM/CD/Processing/Aggregation, Reporting Services, which cause many collisions and unpredictable behavior.

If you bring your own Sitecore xDB, you must:

    Disable Sitecore xDB Cloud for both Delivery and Editing Farms. Select the /sitecore/system/Modules/Azure/{Environment}/{Location}/{Farm}/Role01/{Staging | Production}/Options/xDB Cloud Edition item and release/uncheck the Enabled check box in the Data section.
    Update the Deployment Type Exclude Files [Applied to specific Deployment types only (CD/CE)] field in the /sitecore/system/Modules/Azure/{Environment}/{Location}/{Farm}/Role01/{Staging | Production} item with a list of disabled *.config files, which you can find in the following article:
        For Delivery Farm – Configure a content delivery server.
        For Editing Farm – Configure a content management server.
    Bring your own:
        Sitecore installation that is configured as the Processing/Aggregation role according to the Configure a processing server article.
        Sitecore installation that is configured as the Reporting Services role according to the Configure a Reporting Service server article.
        Solr server for hosting a distributed sitecore_analytics_index.
        Collection MongoDB Server that is configured according to  Configure a collection database server to the article.
        Reporting SQL Server that is configured according to the Configure a reporting database server article.
        Session database servers that is configured according to the Configuring session database servers article.

For more information what servers Sitecore XP requires please see the Configuring Servers article.

Please note Sitecore xDB Cloud it not only MongoDB server. There are many other components with dedicated servers and services. For more information about xDB Cloud please see the xDB Cloud overview article.

We :  We’ve already done these steps
Support Team : Sitecore XP product is shipped with Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider and Sitecore.SessionProvider.Sql.SqlSessionStateProvider session state providers. Where first uses MongoDB as session storage and the second one uses SQL Server. You can use either one and there isn’t not specific recommendation, but SqlSessionStateProvider provider might be a bit faster, and most of the customers typically prefer using SQL one in combination of Sitecore Azure + Sitecore xDB Cloud.
We : The article presented here . https://doc.sitecore.net/sitecore_experience_platform/81/setting_up__maintaining/xdb/session_state/walkthrough_configuring_a_private_session_state_database_using_the_sql_server_provider/ 
says: “These performance enhancements move the session state store to SQL Server tempDB which is the standard practice recommended by Microsoft. However, this is not supported on Windows Azure.
For more information see Session-State Modes on MSDN.”

Support Team : There is one think you have to do before deploying Sitecore Sessions SQL database to Azure SQL Databases service.

Run the following scrip to drop the CreateTables stored procedure that is not used.
USE [Sitecore_sessions]
GO
/****** Object:  StoredProcedure [dbo].[CreateTables] ******/
IF OBJECT_ID(‘CreateTables’) IS NOT NULL
DROP PROCEDURE [dbo].[CreateTables]
GO

For more information on how to deploy Sitecore databases to Azure SQL Database see the following article:

https://github.com/olegburov/Sitecore-Azure-Content/blob/master/articles/how-to-deploy-sitecore-databases-to-azure-sql-database.md

> Why does the Sitecore document states that performance enhancements are not supported in Windows Azure, can you elaborate and help us understand why?
The performance optimization that the Performance Boost.sql scrip brings is based on the tempdb, which is not supported by Azure SQL Databases. Therefore, you can’t apply the script and have to remove the CreateTables stored procedure, which relates to the script.

Web Analysis:

  1. During MVP Summit, lot of people said. Good to use SQL Provider instead of Mongo
  2. Good thread : https://community.sitecore.net/developers/f/9/t/118#pi214filter=all&pi214scroll=false “Currently (in SC8), the Session state provider on Mongo is a bit slower than SQL Server (~20%). Apparently this is a thing on the side of the implementation of the session provider itself and it shall be fixed in the upcoming version of Sitecore. The reason for chosing Mongo over SQL is mainly because of simplicity and the characteristic of the session data. You could still use SQL Server with Mongo though.”

    ” At the moment, I would recommend the sql session provider. I have laerned about some performance issues on certain circumstances with the mongo session provider – so right now, I will recommend sql in any situation.”

  3. Wait for Sitecore to come up with Redis Provider — Which is happening soon. Redis is a winner for Out Proc session storage — Refer Martina‘s article.

Quick summary:

  1. If you can switch to SQL Session State provider do it!
  2. If not, then make sure you add Index manually to sharedSession DB

Filed under: Architecture, Performance, Sitecore, Tips and Tricks

Sitecore Instance Manager error

$
0
0

Challenge:

It is near to midnight in India and my phone is saying me that I should go to sleep. But before I go for sleep. Would like to make sure I blog my learning which took most part of my day and was scrathing my head.

So, I got a new laptop which has Windows 10 on it. Was trying to configure your and mine favorite Sitecore Tool – SIM (If you haven’t heard of Sitecore Instance Manager (SIM) and you are newbie then it’s fine. It is Army knife of Sitecore Developer, and a must need to have tool in your toolset)

After installing was trying to pass through initial configuration and it was tough to pass through following dialog.

“You probably don’t have necessary permissions set. Please try to click ‘Grant’ button before you proceed.”

 

If you are also facing this then this post might help you. So, let’s see what I found while troubleshooting this.

Solution:

  1. I went to c:\inetpub\wwwroot – And made sure that NETWORK SERVICE user has full access on main folder and sub folders – It was there!
  2. Did a quick search and found few good articles:
    1. http://sitecoreblog.patrickperrone.com/2015/04/a-simple-error.html
    2. https://github.com/Sitecore/Sitecore-Instance-Manager/wiki/Troubleshooting
    3. In Summary, This seems file system related error. But behind the scenes it also tries to check SQL rights. So, go back and make sure your connection string is right. What I would suggest you to do is. Take that username and password and try to login using SQL Server Management studio and try to create dummy database and delete it using same credentials. This should work. Also, make sure you are running your SQL Service using NETWORK SERVICE account
    4. Also, please make sure you are  running SIM as Administrator user
  3. One more thing, Make sure your SIM.EXE is not blocked, as it was downloaded from Web. If so, please unblock it
  4. After doing SQL Server related changes make sure you restart SQL Server – Then only changes will take effect

Then I got busy with other things and thought to find Plan B. Which was installing Plain Sitecore using Sitecore installer. I did that using Sitecore Installer (exe) was able to install Sitecore successfully!

But still that problem was still going on in back of my mind [We are same! ;)]. So, thought to ask few awesome Sitecore developers internally they gave few ideas. But everything was tried. Was about to go to bed and thought to troubleshoot a bit and then go for sleep. And I tried to reproduce the issue. But couldn’t, it was fixed! How?

As per my understanding:

  1. All above mentioned changes
  2. And Installing Sitecore using Sitecore installer

Fixed this issue! I can’t say it confidently. Till I get fresh laptop where I try exact same steps or one of you also try the same and confirm it for us!

Or Alen might have some idea and he improves that error message which indicates exact error message.

After writing above line, I realized that SIM is now open source and Alen and Sitecore’s vision will be fulfilled. If I am able to find this BUG and Fix it or narrow it down. So, I went ahead and cloned repository in my local and have been able to locate code which is causing this behavior. message variable is same for both scenarios – File system and local

https://i.imgur.com/3ugOPlS.png

And this is what TestSqlServer method does:

After looking at code, I noticed that there has been lot of logging going on. So, thought to find out log file and found it here : C:\Users\<USERNAME>\AppData\Roaming\Sitecore\Sitecore Instance Manager\Logs and found following errors:

1 13:25:09,168 DEBUG                           SQL Server Account name: LocalSystem
1 13:25:19,185 ERROR Cannot create a test database
System.Data.SqlClient.SqlException (0x80131904): Cannot open database “DBNAMEWHICHDOESNTEXIST” requested by the login. The login failed.
Login failed for user ‘lsa’.
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
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.ProviderBase.DbConnectionClosed.TryOpenConnection(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 SIM.Adapters.SqlServer.SqlServerManager.TestSqlServer(String rootPath, String connectionString)
ClientConnectionId:093bd696-1e58-4662-9e5b-2a172e5619ae
Error Number:4060,State:1,Class:11
1 13:25:42,751 DEBUG                           return False (System.Boolean)

After verifying connection string setting in SIM, I noticed some change:

Not working : user id=sa;password=*****;Data Source=MACHINENAME\SQLEXPRESS;Database=DBNAMEWHICHDOESNTEXIST

Working : Data Source=(local)\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=******;Connect Timeout=1

Working one must have been modified by Sitecore installer. Because I haven’t changed it.

This would have been easy fix. If error message was in sync with backend error — Now, we understand end user’s challenges better!😉

In Summary,

  1. If you are getting such error, along with file system verify SQL related configurations
  2. Look at SIM Logs
  3. Don’t forget SIM is open source, clone repository and troubleshoot!
  4. Found and fixed it? Don’t forget to contribute your fix to make SIM better — Yes, Yes, I am also going to do that. Once I test my solution in local

Have a seamless SIM installation!🙂


Filed under: Sitecore, Sitecore Bugs, Tips and Tricks, Tools Tagged: SIM

Sitecore Azure Basics

$
0
0

Challenge:

In a small city, there is a company. Where two people work – Mr. Basics and Ms. Curious. As name suggests Ms. Curious was always curious about anything. Whenever she used to see something new, she used to go to his friend. Mr. Basic. Again as name suggests Mr. Basic was always clear with his basics. And when anyone used to come to him with questions. He was helping them understand with all the basic information he had!

Disclaimer — All characters in this publication are entirely fictitious and any resemblance to real persons, living or dead, is purely coincidental.

Also, If you noticed in following posts I used male characters. But knowingly in this story I am adding female character. I would like to encourage more girls to code : https://girlswhocode.com/

  1. https://sitecorebasics.wordpress.com/2015/04/04/sitecore-multisite-basics/
  2. https://sitecorebasics.wordpress.com/2013/02/06/transfer-tool-media-transfer-bug/

So, Ms. Curious came to know about Sitecore Azure which is buzzing since 8.2 update-1 launch and she has already been through few articles on web. But still she prefers to talk to her friend Mr. Basics. So, Mr. basics as always explains all basic details about Sitecore Azure to Ms. Curious. This post shares chat between them. Which you might find helpful. If you are in same boat as Ms. Curious!

Solution:

Read from left to right :

1 23 45 67 8

Hope you found this chat helpful! Also, Would like to Thanks to all SC Community members for sharing their learnings as well SC documentation team for nice documentation. Which allowed Mr. basics to simplify Azure learnings. Thank you all of them!

Before you go to last section, Would like to say Thank you (Yes, you!) my dear reader for reading, sharing, visiting, and commenting on my blog. This blog is my open diary. Which I share with you. 2016 had been great year, on our blog — We got 85K views and 15 blog posts. Which makes 167 blog posts overall and 327802 Page views! Thank you – Humble, Grateful!

azure-happy-holidays

Happy Holidays, Have a great time with your loved ones!

Resources:

  1. http://www.sitecore.net/en/company/blog/489/five-reasons-why-microsoft-azure-web-apps-and-sitecore-are-a-match-made-in-heaven-4415
  2. http://blog.baslijten.com/category/azure/
  3. https://jermdavis.wordpress.com/2016/12/12/the-brave-new-world-of-azure-paas/
  4. https://doc.sitecore.net/cloud/
  5. https://mhwelander.net/2014/09/23/sitecore-azure-for-beginners-part-1-what-is-microsoft-azure/
  6. https://www.cmsbestpractices.com/choosing-the-right-hosting-option-for-sitecore/
  7. https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-overview
  8. https://tryappservice.azure.com/

Filed under: SC Azure, Sitecore, Tips and Tricks Tagged: Azure, Sitecore, Sitecore Azure

Sitecore Helix Basics

$
0
0

Challenge:

Hey Friends, I’m excited to share many of first post of 2017! So, far it has been great year and I know a lot of you are MVP now or MVP Again — Congratulations Very well deserved! – Please make sure you help someone else become one — Because sharing is caring — Nice story

Since last year we have been hearing a lot about Habitat and then Helix and lot of people appreciating what Habitat or Helix is. You also heard/read about it? But:

  • You are afraid of It? Because Habitat solution is huge and you get confused how to set it up. Because it involves a lot of tools to set up e.g. gulp etc. [This is good point to upgrade your web/technology knowledge. It is evolving a lot. All of us accept that FED Technology is seeing lot of huge changes, and .NET Core team is doing super awesome stuff. If you don’t upgrade your self, there are chances of you being dinosaur in this industry]
  • Confused between Habitat and Helix
  • You setup your Habitat solution. But when you opened it. You got overwhelmed?
  • In this process, you don’t know how to get started and what’s the starting path for you to embrace Sitecore Helix?

Then this post is for you — This post will do 95% job to help you getting started on Helix — What about other 5%? — Will share about it before end of this post. So, let’s Helix

Solution:

Before we get further in technical details. Let’s try to understand what is the dictionary meaning of “Helix” – Wiki says “an object having a three-dimensional shape like that of a wire wound uniformly in a single layer around a cylinder or cone, as in a corkscrew or spiral staircase.”

Source : Wiki

It will be great to hear about naming directly from horse’s mouth some day.

Let’s get on point, How I got started on Helix? Exactly in same order:

Okay, Thank you for those resources. But can you please share your basics with me? So, I can get quickly started. Sure, here we go. I will share my learnings and understandings:

  • What is difference between Habitat vs Helix?
    • Helix :
      • Sitecore® Helix is a set of official guidelines and recommended practices for Sitecore Development.
      • Set of architecture conventions and guidelines that describe how to apply recommended technical design principles to a Sitecore project.
      • Secure implementations in a future proof way by architecting them as maintainable and extensible business centric modules
      • Development process recommendations to make it as easy as possible to build, test, extend, and maintain Sitecore implementations
    • Habitat :
      • Habitat is an example project that follows the Helix principles and recommended practices.
      • PLEASE DON’T USE HABITAT AS FOUNDATION/STARTER KIT FOR YOUR NEW PROJECT – HABITAT IS NOT BUILT FOR THAT
  • Why we need Helix?
    • Dependencies : If you look at dependencies, left side-show non helix project — Where any module is talking to any module — And as project becomes huge. No one makes small change with confidence — To make a one line change — Developer/QA/Stakeholders — Have to keep their fingers crossed. And still they have issues and because of it, they either have to miss dinner/lunch/outing with friends/baseball match/cricket match. But when things are done Helix way — right side. There are some standard ways – How each module talks to each other — And that gives everyone full confidence before making any change! — It is simple maths — Invest on strong foundation and take returns in a longer run! dependencies
    • Following diagram, clarifies that — As the project dependencies grow — lot of time spent on coupling rather than feature — and that increase time taken as well!why-helix
  • There are some logical layers defined, and you try to follow it – This image is very self explanatory. You just need to know three things – Foundation, Feature, Project – And each one of them should hold things which suits to their name:layers-basic
  • Benefit of using proposed layers — See this example – When you have multiple sites — They can have all foundational and featured things available! – Standard Sitecore Multisite way of doing things:layer-example
  • Helix also guides you how you need to structure your templates – Which are heart of any Sitecore projects : helix-template-inheritance
  • There are few Helix dependency rules you need to follow — You can break it. But then there is no point in using Helix:helix-rules
    • There is a strict reference hierarchy of module categories. Projects -> Features -> Foundations.
    • Project modules cannot reference other projects, but can reference any Features and Foundations.
    • Feature modules cannot reference any Project modules or other Feature modules. They can reference Foundations
    • Foundations can only reference other Foundations.
  • How to add advance things like GlassMapper, Sitecore 8.2 DI, Code Gen, TDS : Good question, We spend sometime and made it possible. This thread might help you get quick started [If not, give me a shout] : http://sitecore.stackexchange.com/questions/4370/few-questions-related-to-helix
  • If you think — There are a lot of Manual steps involved in adding a feature and foundation – Look at the great work done by Marc : http://blog.marcduiker.nl/2016/12/28/hands-on-with-sitecore-helix-using-powershell-add-module.html
  • Akshay also did good stuff taking this forward for initial setup : https://www.akshaysura.com/2017/01/21/habi-what-a-tat-create-a-sitecore-helix-solution-from-scratch-using-powershell/

It seems a lot? I know, I realized after writing. But I wanted to share all our basics with you. Because when we had to start, we were literally struggling to get started. But now, we did it. Thought to share with you. So, it saves some of your time, which you can spend with your loved ones or for other important things!

In Summary,

  • Helix is not a rocket science, It is same Sitecore code. But how and where you write it — That is standardized by Sitecore — As Sitecore support team is also using same methodology. So, it is easy for them to help you troubleshoot
  • Just imagine, your company adopts Helix and all projects which your company does, does in Helix [Including your project :-)]. After sometime, any developer can jump from one project to another project – Project on boarding will be super easy — (S)he just need to know business domain. I have seen lot of project leads, don’t allow new developers on board even though they can support more developers in project — Because of project on boarding — Helix helps us all speak same language!
  • “Helix is like Maths, Once you get it. You enjoy it and would like to do it again and again”

I am sure you must be curious t o know what else 5% I need to do to get 100% knowledge on Sitecore Helix? It’s simple — Get your hands on it. Coding is like swimming. You have to dive in to swim/code!

It was fun to work along with Muktesh and Varun on Helix basics! Thanks to all folks who already wrote about it, which helped us to get it started sooner!

Good read:

  1. http://helix.sitecore.net/
  2. http://www.sugcon.eu/wp-content/uploads/2016/05/Introducing-Sitecore-Habitat.pdf
  3. http://www.sugnl.net/~/media/SUGNL/Meetings/Developer%20track%2019%20oktober%202016%20Achmea/Downloads/SUGNL%20Meeting%20Achmea%2020161019%20%20Robbert%20Hock%20%20Symposium%20recap.pdf
  4. https://www.dynatrace.com/blog/adding-the-how-to-what-for-sitecore-helix-test-automation/
  5. http://www.hhog.com/blog/sitecore-helix-fxcop-rules/

Happy Sitecoring! 🙂


Filed under: Architecture, Latest, Programming, Sitecore Tagged: Architecture, Helix, Sitecore

TDS error while generating update package

$
0
0

Challenge:

It was Friday evening and it was time to sign off for the day and go on long weekend trip. Just before that we had a task to send a deployment package. And suddenly my friend Vikram shouted — While generating TDS Update package, We are getting this error

TDS: The package builder failed. Please see build output log for more details

When I went to his desk and said – Oh that’s easy. Just look at output log and we should be done! But It’s real world life, which is not as easy as it seems. You are also facing same error? Searching for solution? Then this post is for you:

Solution:

After trying few things we thought to do quick search and we found following great articles:

  1. https://theagilecoder.wordpress.com/2015/06/09/tds-the-package-builder-failed-after-project-rename/
  2. https://aldrichdev.wordpress.com/2016/06/09/tds-the-package-builder-failed-please-see-build-output-log-for-more-details/

Both have listed good suggestions. But neither of it worked for us. But might work for you. So, please do it before you move on. What, you already tried and then landed on this post. Then please keep reading. We thought to look at Build log level. By default they are minimal after changing it to Diagnostic. And when we tried again, we were able to find root cause from build output window that one of the .item was corrupted. As such it was not mandatory to have it. So, we deleted it AND It worked!

build-output

Happy Weekend! 🙂


Filed under: Sitecore, Tips and Tricks, Tools Tagged: TDS

Quick Helix deployment approach

$
0
0

Challenge:

I have been looking at a why, how we can deploy Helix approached solution without adding lot of tools and complexities. After investing some quality time. Have been able to do it. Few tweaks are required to this process. So, it can be automated. But basic idea should get you going!

Solution:

As you know each Foundation/Feature/Project – might have one web project Files which needs to be deployed to webroot. And TDS Items as well. Let’s look at each of them:

  1. Files : To deploy files, I prefered to use my old and gold – Web deploy! As you know for webdeploy and Visual studio publish for web project to work you need .pubxml and it holds few configurations. To centralize those configurations, here’s what we did:
    1. In Configuration folder created .targets file e.g. scbasics-pubsettings.targets
    2. Which contains publish related configurations  e.g. WebPublishMethod,MSDeployServiceURL etc.
    3. Each Web Project has its own .pubxml file which points to .targets file which we created earlier <Import Project=”..\..\..\..\..\..\Configuration\scbasics-publishsettings.targets” />
    4. So, using above approach, Configurations are centralized. So, in case if you have to change anything. You change it at one place rather than changing lot of places [depends on your feature/foundation/project count]
  2. TDS : We had access of Target server using HTTP. So, we just added required configuration in TdsGlobal.Config for that particular environment. And TDS is smart enough to take care of it!

I have not been able to hook it with Teamcity and do automated deployment yet. But when I do it using .sln — I can foresee only one challenge — Build ordering – Because your project should be built at last and it should copy root’s Web.Config. But that can be resolved with some ways — Which I’ve left for you! 🙂 Or you know If I spend time on it, will share with you — I expect the same! 😉

One more Helix puzzle resolved!

Happy Deployment! 🙂


Filed under: Helxi, Sitecore, Tips and Tricks Tagged: Helix, Sitecore

Helix, 8.2 DI and An error occurred when trying to create a controller of type ‘ScBasics.Feature.Nav.NavController’. Make sure that the controller has a parameterless public constructor

$
0
0

Challenge:

The best part of our lives is, Whatever/However experience you are you will face one exception/error which challenges your experience. And that’s what happened with me recently. And I am sure you agree — That’s when your basics come to rescue — Same was the case in my case.

We were deploying Helix based solution which was working like a charm in local. [In case you haven’t heard of Helix/Habitat yet – Which I don’t expect to be the case. But If heard and not explored/clear on it. Then this post might help you]

https://i1.wp.com/www.ybrikman.com/assets/img/blog/docker/say-works-on-my-machine.jpg

But as you know “life is not as easy as it seems to be” When we deployed it on Dev/QA environment. We met following error:

Sitecore.Mvc.Diagnostics.ControllerCreationException was unhandled by user code
  ControllerName=Navigation
  HResult=-2146233088
  Message=Could not create controller: ‘Navigation’.
The item being rendered is: ‘/sitecore/content/SCBasics/Home’.
The context item is: ‘/sitecore/content/SCBasics/Home’.
The current route url is: ‘{*pathInfo}’. This is the default Sitecore route which is set up in the ‘InitializeRoutes’ processor of the ‘initialize’ pipeline.
  Source=Sitecore.Mvc
  StackTrace:
       at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName)
       at Sitecore.Mvc.Controllers.ControllerRunner.GetController()
       at Sitecore.Mvc.Controllers.ControllerRunner.Execute()
       at Sitecore.Mvc.Presentation.ControllerRenderer.Render(TextWriter writer)
       at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
       at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args)
       at (Object , Object[] )
       at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
       at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
       at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
       at Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering.Render(String placeholderName, TextWriter writer, RenderPlaceholderArgs args)
       at (Object , Object[] )
       at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
       at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
       at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
       at Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName)
       at ASP._Page_Views_Website_Layouts_Default_cshtml.Execute() in c:\…..\Website\Views\Website\Layouts\Default.cshtml:line 38
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
       at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
  InnerException:
       HResult=-2146233079
       Message=An error occurred when trying to create a controller of type ‘SCBasics.Feature.Navigation.Controllers.NavigationController’. Make sure that the controller has a parameterless public constructor.
       Source=System.Web.Mvc
       StackTrace:
            at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
            at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
            at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName)
       InnerException:
            HResult=-2147467261
            Message=Context is null
            Source=Glass.Mapper
            StackTrace:
                 at Glass.Mapper.AbstractService..ctor(Context glassContext) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper\AbstractService.cs:line 103
                 at lambda_method(Closure , ServiceProvider )
                 at Sitecore.Mvc.Controllers.SitecoreDependencyResolver.GetService(Type serviceType)
                 at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
            InnerException:

You might say that’s easy “controller has a parameterless public constructor.” – Just add this and it should work 🙂 But same code works in local, and second thing is we are using Sitecore 8.2 DI for controllers. And in that case, it is not required to have parameter less public constructor. And if it is same error for you, it means that, your DI is not working.

You are also facing same error? Then this post might help you!

Solution:

So, as every developer on this earth does, We also did a quick Google search and found following links, which were helpful:

  1. http://sitecore.stackexchange.com/questions/2929/no-parameterless-constructor-defined-for-this-object-after-upgrade-to-sitecore8 – dnstommy’s reply gave us a hint that our DI is not working
  2. Apart from this there were no any good results on web. So, now it was time to look back in code and see how things laid down and figuring out what’s going on

Troubleshooting process:

public static class ServiceCollectionExtensions
  {
    public static void AddMvcControllersInCurrentAssembly(this IServiceCollection serviceCollection)
    {
      AddMvcControllers(serviceCollection, Assembly.GetCallingAssembly());
    }
// Removed for simplicity
 public static void AddMvcControllers(this IServiceCollection serviceCollection, params Assembly[] assemblies)
    {
      var controllers = GetTypesImplementing<IController>(assemblies)
        .Where(controller => controller.Name.EndsWith("Controller", StringComparison.Ordinal));

      foreach (var controller in controllers)
      {
        serviceCollection.AddTransient(controller);
      }
    }
// Removed for simplicity
}
  • Looking at code, it makes sense. But it works in local. But not when deployed. So, after troubleshooting a bit. Thought to log what we get in calling assembly — We also faced challenge here. Sitecore logging will not work at this layer. So, we had to use plain old StreamWriter [You remember, I told. Basics!?]
  • The log results were something like this:
    • In local : In Calling assembly we were getting Feature assemblies
    • In QA/Dev : In Calling assembly we were getting Sitecore.Kernel
  • It was clear, Assembly.GetCallingAssembly() was misbehaving
  • Quick Google search reveled the mystery, GetCallingAssembly works different in Debug and Release mode https://blog.codeinside.eu/2014/10/05/Be-Aware-Of-Asssembly-GetCallingAssembly-Behaviour/
  • In local we are using Debug mode and on QA/Dev – We are using Release mode
  • Root cause “The JIT compiler moves code around to optimize for performance. Small methods (up to about 56 Byte IL-Code if I remember it right) can be inlined where the method call was before. But the compiler does this only in release, not in debug mode. Also when attaching the debugger to our release build the JIT compiler stopped inlining to enable debugging and our bug was gone” : Source : http://www.ticklishtechs.net/2010/03/04/be-careful-when-using-getcallingassembly-and-always-use-the-release-build-for-testing/
  • Last post had an approach — Adding [MethodImplAttribute(MethodImplOptions.NoInlining)] on method — Which somehow didn’t work for us
  • But then thought to look for some better options and we found it!
  • We added one more Service configurator in Foundation which has following code:
namespace SCBasics.Foundation.DependencyInjection.Services
{
    public class RegisterAllFeatureControllers : IServicesConfigurator
    {
        public void Configure(IServiceCollection serviceCollection)
        {
            /* We were facing issue in Release mode
               Which was not resolving
            */
            serviceCollection.AddMvcControllers("SCBasics.Feature.*");
        }
    }
}
  • Above code, uses an alternate method for adding MVC Controllers and best part of this approach is. You no need to register your controllers, which you added in feature project. This foundation project will automatically do it! [BTW, Nothing is automatic, we wrote one time code for it ;-)]

Happy Coding! 🙂


Filed under: Helix, Sitecore Tagged: Helix, MVC, Sitecore

The Sitecore Basics Test : Symptoms of failing Sitecore Project

$
0
0

I have been fortunate enough to work on Sitecore projects since last 8 years of my overall 10 year’s experience. Throughout 10 years – I have  successful/unsuccessful projects.

I thought to prepare a list which helps you to identify [If you want to ;)] whether your Software project is failing or not and I like this article a lot — https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/ – Great test!

Recently I was reading Peopleware — It has the first chapter “Somewhere Today, a Project Is Failing“. – They did research on 500 projects — which they measured on project size, cost, defects, acceleration factors, and success or failure in meeting. Stats are as below:

  • 15 % : Canceled or “postponed” or they delivered products that were never used
  • 25% : For bigger projects, the odds are even worse, they lasted 25 work-years or more failed to complete

In earlier surveys, they discarded these failed data points and analyzed the others. Since 1979, they have been contacting folks who left from projects to find out what went wrong, Most part of the projects they studied, there was not a single technological issue to explain the failure.

I thought to compile similar set of list for Sitecore projects – Because while I’m writing and you are reading – Somewhere Today, a Sitecore Project Is failing.

Before we start would like to mention few things:

  1. Joel’s list is the base class for this list — Because Points which Joel has mentioned applies to any kind of project
  2. Will derive from Joel’s list and jot down my observations specific to Sitecore – It might fit or might not fit for your organization — Please use your own judgement [Listen your team’s views – Analyze – Conclude]. Before you derive something. If you have more better steps — please share

I’m excited to share what I learnt in 8 years, which you might learn in 8 minutes – That’s why I’m born – Born to share – Here we go:

Just a note : These symptoms applies to all kind of projects — Product/New Project/Enhancement and Support Project

  • Tough to onboard new Developer : If on boarding new developer is taking weeks or people say – No, we can’t onboard new developer new Developer in crunch time without logical reasons and gives you a reason that on boarding will take time from project developers or will take weeks. Then this is a sign of failing Sitecore project. This means everything is unmanaged. No one has documented on boarding steps [They are insecure?!] or current developers configured their Development environment anyhow and now they don’t recall what they did. My rule of thumb is — In 4-6 hours [Vary based on project’s external dependencies e.g. Commerce, SOLR, etc] and a document should be more than enough to onboard new developer. If your teams says No — Take a step back, listen their reasons. And analyze it.
  • Sitecore Developers don’t know what they are doing : During demo/in meeting, when you ask in-depth “Why” [Is this the best way to do this in Sitecore? Is there a simplified way to do this?] questions and Sitecore Developers can’t explain you in simplified manner — Something is not right. It’s time to get right partner/developer onboard!

https://s-media-cache-ak0.pinimg.com/originals/63/e1/34/63e1340fc40edcce7010ce9500937a1e.jpg

  • Huge Estimates : When you see huge estimates for simple set of tasks, It means that things are not rightly architected If project is new then it’s fine. As building robust framework takes time. But if it is taking longer for later sprints or for support and enhancement – Then you need to talk to your team. Again, It might be a case lead Developer has left and new Developers are trying to understand and implement solution – This is fine to have situation – And each project has a bit of learning curve, As there were no defined Sitecore project architecture standards — It was different company by company or in some cases project by project. And that’s why Sitecore and Sitecore community is excited to learn and implement Helix You should come out of cave, If you don’t know about Helix and read about it!

why-helix

 

You might have smart developers onboard on project. But past implementation has been super tightly coupled, One change can break N number of things or ruin someone’s evening plans or weekend 😦

  • Developer spends more time in figuring out “What” And “Why” then “How” : Your requirements are super vague. To work on feature A which is in reality 4 hours task. Developer spends 6 hours figuring out all material and still not clear what exactly needs to be done. As soon as he/she knows they are able to complete work in less than 4 hours. Other symptoms are – Team is more busy in meetings than being in zone – Scrum runs for hours and hours, Sprint planning runs for hours and hours, With whole project team. If you hearing <1 Man day task in next day scrum without any blocker — Then something is not right OR Your team is performing less than their capacity/velocity — Then you should talk to team!. Another sign is — If you ask two team members about Project schedule and you hear different answers — It’s time to talk. [Good read — About Watermelon Culture]
  • Developers don’t have good tools : From my point of view Sitecore Developers must need to have some good tools e.g. Reflector [My personal favorite], TDS Classic, Glass Mapper [If your team is still handy crafting models and not using code generation then they are investing their time in wrong things] etc.
  • Sitecore Items are not version controlled : This is the biggest sin from my point view. Your Sitecore items are as important as your code [In some cases more than code].  Can you imaging Software industry without version control? I know you tried that in college project[.zip of .zip, final .zip, .backup of .backup :)] — That doesn’t work – We are professionals. You are in to serious business — I like this chapter from 97 things every programmer should know book  : http://programmer.97things.oreilly.com/wiki/index.php/The_Professional_Programmer

“Professionals do not make a mess. They take pride in their workmanship. They keep their code clean, well structured, and easy to read. They follow agreed upon standards and best practices. They never, ever rush. Imagine that you are having an out-of-body experience watching a doctor perform open-heart surgery on you. This doctor has a deadline (in the literal sense). He must finish before the heart-lung bypass machine damages too many of your blood cells. How do you want him to behave? Do you want him to behave like the typical software developer, rushing and making a mess? Do you want him to say: “I’ll go back and fix this later?” Or do you want him to hold carefully to his disciplines, taking his time, confident that his approach is the best approach he can reasonably take. Do you want a mess, or professionalism? ”

Please read this : http://hedgehogdevelopment.github.io/tds/chapter1.html#why-tds-classic-works

“We have found TDS Classic easily affords an 8%-15% decrease in costs (time) to develop a Sitecore solution regardless of the size of the project. A 10% savings over 30 weeks for a 3 person team is 9 weeks of gained productivity. If the average team member salary is $75k per year this represents approximately $13k in savings.”

If you have budget constraints? Sitecore community folks have done lot of good things – Especially Kamsar‘s Unicorn

I love Sitecore items to be Version controlled because:

  • Developers can have their own Sitecore Database copy
  • Which is blessing when you have Developers who are connecting over VPN to your shared Database — VPN is still not the best solution our industry found
  • They can make Sitecore level changes without breaking anyone’s challenge
  • This is the first step for automatic deployment
  • Everyone is accountable
  • Easy to track, compare and revert!
  • Sitecore Configuration Patching is not used : This is also super important to have. Sitecore configuration patching helps you to keep your Sitecore configuration changes in control for development, deployment, troubleshooting and version upgrade. The day your configurations are out of your control — You are done!
  • Deployment makes your nervous : Obviously, when you say – Live/Production deployment people feel bit nervous. But each time it makes you super nervous and you have a lot of deployment failures/revert – This is sign of some loophole in system. It can be either process, wrong implementation, folks don’t know what they are doing, no/less code reviews, tightly coupled code, QA is not involved in project. Any Developer goes and deploys files in lower environment/in some cases production/live environment. No one takes a lead to take a lead on deployment failure. No one wants to retrospect. I have worked with a team, Where when you say production deployment. They start planning for party — Because they have full confidence on what they have done in their local machine/lower environments, is nothing but a master piece of professional and elegant work! If your deployment is still manual and runs for hours and hours [Think of Web farm with 20+ servers] then you need to stop development and start thinking to automate or semi automate your deployment process OR If you can’t automate please simplify the process. Discourage tame to make last-minute changes or change go live date.
  • No proper handshaking between teams : I always visualize Sitecore Development – Deployment is same as like Assembly line.  If one player/team is slow. It will slow down whole process. [Read The Goal book?]. It’s not because of technology. But no proper team environment. There are teams within teams. UI Developers should always be ahead of Backend developers and QA should be always ahead or aligned with backend developers. QA should be involved in process at right time. I always prefer to have BED and QA work parallelly – Developer writing code and QA writing test cases.

https://www.hash.com/forums/uploads/monthly_06_2007/post-3557-1180792087.jpg

  • Site performs poor without caching :Sitecore being an enterprise level CMS provides state-of-the art Sitecore caching. But lot of bad implementation tries to hide behind Sitecore caching – I always prefer to do load testing without Sitecore caching. If you can meet your thresholds during this then you will be able to beat your competitors when you go live! Also, It’s always good to have time for performance testing and tuning (Another gold mine is your Sitecore log files – Great Sitecore Developers always prefer to check log files before they Go-Live for Project/Product/Sprint). If your team says – We don’t have time for performance tuning — It’s time to talk!
  • Content authors need a lot of hand holding or coming up with lot of questions : This means things are not simplified enough or Sitecore’s OOB features are not used e.g. Add Rendering, Placeholder settings, Data source etc.
  • All plans fail without Content Matrix Plan : If you are ensuring UI, Backend, QA, Servers, DevOps folks, Process everything is good. But in case if you missed to plan, Content management/entry for your huge site — Then your project will get delayed. Because content management is also a critical task. If you have a new site and there is a lot of content your content team should start adding content as soon as they can

Found helpful? I repeat, this is not a fully comprehensive list. I’m sure you will have your learnings which you should share with us — So, you will be able to save that failing project.

Happy Sitecoring! 🙂


Filed under: Helix, Sitecore, Tips and Tricks, Tools, Upgrade

Integrating Cognitive Services to set ALT Tag during Image Upload

$
0
0

Challenge:

It is interesting – How this idea came up. Basically, was browsing Facebook page and while doing that – My Internet was slow and during image load process — I noticed an ALT Tag — Which had something like this and when Image got loaded. It had exactly same thing!

 

While this thing got stuck somewhere in mind. Came across following videos [Which I’m sure most of you as well]:

And that revoked the thought process. Especially — For those who are not as privileged as you and me to see the world. But through technology if it helps them visualize — That will help!

Then came across this link : https://azure.microsoft.com/en-us/try/cognitive-services/ [“Microsoft Cognitive Services let you build apps with powerful algorithms using just a few lines of code. They work across devices, keep improving, and are easy to set up. Try the Cognitive Services APIs for free.”] — This is really awesome – As For me impacting human lives and making it better using technology is the only thing which drives me in to this field. I’m sure for lot of you as well!

It provides the lot of services, which I recommend you to explore. But for this blog post, We only need : https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/ – You can try it out before you use it!

Tried few things and created simple Console application as per this doc : https://azure.microsoft.com/en-in/services/cognitive-services/computer-vision/

And was impressed to see how it works — It just works! – My eyes lit up – And as you — I always think — How can I integrate this in Sitecore. And that’s how this blog post came in to this world!

https://i1.wp.com/boardofwisdom.com/cachetogo/images/quotes/524839.png

Let’s see how — I have been able to integrate it with Sitecore!

Solution:

You must have observed — Most of the site’s Media Library will have an empty ALT Tag. And it is not easy for someone to go and type such meaningful ALT Tag. Then I thought to use Cognitive Services to suggest us an ALT Tag and based on suggestion set that automatically in ALT Tag field. So, Content Authors/Editors, End users are happy – This is how it works:

 

As you do, I also did Quick search and tried to find is something similar already done. And found Mike’s blog : https://sitecorejunkie.com/2014/06/18/set-default-alternate-text-on-images-uploaded-to-the-sitecore-media-library/ – Where he is extracting item name from path and setting it as an ALT Tag from getMediaCreatorOptions pipeline.

  1. I thought to alter his logic of getting ALT Tag instead of substring making an API call and setting it — Sounds easy, right? But my dear friend life is not as easy as it seems to be — After trying this out — I found that there is no way for me to access uploaded file or uploaded media stream 😦 — I tried to some options. But with no luck
  2. So, thought to try something else — And I tried item:created, item:saving, item:saved and in each of them I had the same problem. Was unable to get Media Stream
  3. It looks like when these events are getting called — It is creating particular media item and after that BLOB gets attached – I’m assuming this. Have asked Sitecore folks to clarify.
  4. Then finally, Thought to implement : uiUpload – Usually I avoid adding anything to ui* processors. As it will only be handled in UI scenarios and not programmatically scenarios. But I had no option and then I thought of YAGNI principle — I don’t need it now as this is my MVP [Minimum Viable Product]
  5. And here’s all the code you need for that — As I mentioned this is just kind of POC – Key and URL should come from Configuration, Code needs to be ironed out. Before it goes on production — And I will leave it up to you for brevity!

Let’s do our bit to make world better than we found it – Happy Coding! 🙂

UPDATE 1 : Thanks Kamruz

After posting this — Kamruz mentioned something similar folks from Community has already done. It looks like I need to sharpen my Google Search Skills – It would have save sometime. But on a +ve side, I have been able to learn and share

  1. https://www.markstiles.net/blog/2017/2/22/sitecore-cognitive-services/Mark
  2. https://marketplace.sitecore.net/en/Modules/A/Alt_Tag_Generator.aspxTom

Filed under: Innovation Tagged: Accessiblity, Sitecore

Sitecore Item Utility

$
0
0

Challenge:

Recently, We wanted to get few critical things done for one of our client before they Go-Live. We had a couple of weeks to get all those things done with minimal changes. [Normal scenario — Correct? ;)].

With that condition, We had to do bulk template change for 1000+ Media Items, as we added some functionality which was required in new template. We had following options:

  1. https://marketplace.sitecore.net/Modules/S/Sitecore_PowerShell_console.aspx?sc_lang=en
  2. https://marketplace.sitecore.net/en/Modules/Bulk_Template_Changer.aspx

They both are great solution for our challenge. Especially Sitecore Powershell. But If you see both need deployment/package install which has the lot of footprints and as I mentioned earlier, we wanted to have minimal changes before we Go-Live!

So, We thought we will build a simple aspx page [With CodeFile] So, It can be deployed without any App Pool Restart and once used tool can be deleted — Use and Throw. I’m sure you all must have built one/another tool like this. But once your Challenge was solved you struggled to find it. So, as I 🙂 That’s why I thought to blog this!

Solution:

This is how it works:

You can download code from here and modify it as per your need and if you think it can help someone on this earth — Please share your great work!

  1. https://github.com/klpatil/SCItemUtil
  2. https://github.com/klpatil/SCItemUtil.git

Just a note : It is CodeBehind. But It should be CodeFile. So, it works without compiled DLL and No App Pool Recycle will be caused by this deployment

I hope this saves some of your time as it did for us. And you have time doing things which matters the most!

Happy Coding! 🙂


Filed under: Shared Source Module, Sitecore, Tips and Tricks Tagged: Module, Sitecore

Speed up project load time for Helix and TDS based Solution

$
0
0

Me and my colleague have been talking and we were noticing VS Hang during branch switch for one of our Helix based solution. Which has the lot of TDS Projects. We noticed when we switch branch. TDS Code generation starts code generation. Which Technically we don’t want. We want it when we do some item level changes. If you are also noticing similar challenge. Then TDS Classic team has solution for you, Which you might have not been aware/thought of.

Go to Visual Studio – Options and from here – You can configure it as per your need. And it will be persisted across all Visual Studio Instances as it is Global setting.

Read more : https://hedgehogdevelopment.github.io/tds/chapter4.html “TDS Classic Options Window”


Filed under: Sitecore, Tips and Tricks, Tools Tagged: Helix, Productivity, Sitecore, TDS

Sitecore TDS Classic Deployment over HTTPS

$
0
0

Challenge:

In case if you are using TDS. You know that it simplifies Development and deployment a lot. [If you are not — Then I strongly recommend — Read more Why : https://hedgehogdevelopment.github.io/tds/chapter1.html#why-tds-classic-works]

I have been lucky enough to configure it for lot of projects to make it deployment process smoother — Especially with TeamCity. Recently, I was doing it for one of the project where Target server works over HTTPS only. If you know internals of TDS Classic – It uses .asmx service as connector to do lot of magic.

When we tried to integrate it we faced following error:

“D:\<PROJECTPATH>\Project.Core.scproj” (default target) (15) ->
(InstallSitecoreConnectorFilesWithRecycle target) ->
C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets(478,5): warning : Server responded with Could not establish trust relationship for the SSL/TLS secure channel with authority ‘HOSTNAME’. [D:\<PROJECTPATH>\Project.Core.scproj]

Tried to search it over Web. But couldn’t find anything useful. So, I thought will write so it appears for you when you search next — Yes, You are facing same problem? Then this post have a solution. Which might work for you.

Solution:

I thought to check with \Hedgehog folks and I really like their support team – Very prompt, Very sharp and super helpful. I got connected with Kliment Klimentov. And he/she had been super helpful related to this issue.

  1. If you have installed Valid SSL Certificate then you no need to do anything
  2. But as we were trying to deploy on lower environment – DEV/QA/UAT — Where we were using IIS Dev Certificate
  3. We got following steps from TDS Classic Support team

You can create a self-signed certificate with correct certificate chain installing makecert and running the following commands:
//this will create the Root CA (if the company is called Test Company, and the subject key is sitecorecert):
cd C:\Program Files (x86)\Windows Kits\8.1\bin\x64
makecert.exe -n “CN=Test Root CA,O=Test Company,OU=Dev,L=Sofia,S=SF,C=BG” -pe -ss Root -sr LocalMachine -sky sitecorecert -m 120 -a sha256 -len 2048 -r
//this is for the certificate itself (if the website has a binding for sitecorecert and the root CA created in the previous step is called Test Root CA):
makecert.exe -n “CN=sitecorecert” -pe -ss My -sr LocalMachine -sky exchange -m 120 -in “Test Root CA” -is Root -ir LocalMachine -a sha1 -eku 1.3.6.1.5.5.7.3.1

Which to be honest, I got confused. Not because of steps. But because my lack of knowledge on this Certificate things. So, read some basics. And tried to break this steps in more simplified manner and thought to share my learnings with you:

My few of the questions were — Okay this steps needs to be done on server then what should be done on client? How to map certificate with site? And so on..

Basically, You need to do Self-Signed Certificate related configurations on both Buid Server [You can also call it as Client] and Web/App Server [Server]

Web/App Server

 

New-SelfSignedCertifcate -DnsName “YOURHOSTNAME”

  • Once done — Open MMC and Add Certificated Snap-In and Export your newly created Certificate [I Was able to find it under “Intermediate Certification Authorities” | “Certificates”]

  • From Site Binding — Use this newly self-signed certificate
  • Visit website and you should be good!

Build/Client Server

  • Copy exported .cer file from Server to Build/Client server [From wherever you were getting error]
  • Right click on Certificate and select Install Certificate
  • When you are on step to select Certificate Store, Make sure you select “Trusted Root Certification Authorities”

  • That’s it!

Have a happy and smooth deployment — Go home with smiling face! 🙂


Filed under: Sitecore, Tips and Tricks Tagged: Deployment, Sitecore, TDS

Talking to inaccessible API using Membrane Service Proxy

$
0
0

Challenge:

This post is not directly related to Sitecore. But indirectly it is. Because Sitecore is what we do at Horizontal Integration

While working for one of our client, We had to call REST API Service built and hosted by them in their environment. Which is not yet live and accessible within their network only. We were doing development from local machine, connected to client network over VPN. But the service was inaccessible via VPN connection.

Due to some technical and security reasons. They were not able to make service accessible over VPN. It was accessible from one of their environment which we could access over VPN. So, Our Development team had to go on that box and do testing from there [Load Visual Studio, Code and Debug]. This was working. But slowing down our team. As we had heavy API Integration.

You are also facing similar issue? Or If not then interested to not how we crossed this brick wall? Let’s have a look at it:

https://i1.wp.com/www.azquotes.com/picture-quotes/quote-the-brick-walls-are-there-for-a-reason-the-brick-walls-are-not-there-to-keep-us-out-randy-pausch-35-67-71.jpg

Solution:

Pictorial representation of challenge and solution

I thought to draw an image, Which helps you visualize overall challenge and solution. Main pointers are:

  • A – Call to REST API Service from Developer machine was failing via VPN
  • B – Call to REST API Service was working from QA/UAT Machine [Within their network]
  • C – We installed Proxy Service on QA/UAT which contacts REST API Proxy and from Developer machine [Connected over VPN] calls Our proxy service rather than REST API Service

So, as you can see to solve this challenge. We configured proxy on QA/UAT Box. When we did an initial search we found the lot of great options. But it involved heavy installation and configuration. We were looking for something light weight. Which can be configured without lot of installation and configuration.

And we found this : http://www.membrane-soa.org/service-proxy/

Quickstart Guide : http://www.membrane-soa.org/service-proxy-doc/4.4/rest-quickstart.htm

It is JAVA Based Application. So, make sure you have JAVA Installed. And ensure Environment Variables are configured properly. As I took sometime to make it work. Here are my steps:

  1. Follow steps 1-3 from Quickstart Guide
  2. Keep it under c:\ [You can keep wherever you need to have it]
  3. set environment variable – MEMBRANE_HOME – <PATH TO YOUR MEMBRANE PROXY FOLDER]
  4. Do Step 4
  5. You are all set!

Filed under: Tips and Tricks, Tools
Viewing all 178 articles
Browse latest View live