DancingGoat MVC binding change causes application runtime exception

ICT Projects Team asked on April 12, 2017 10:36

Hi there,

i would like to ask your help related with a current issue i am having. So, i am doing a POC to test Kentico 10 + MVC in order to evaluate the feasibility of my client to change the architecture and start to use multiple sites (MVC) for only one instance of Kentico.

I found other posts mentioning this project example, and i am testing it. If you install it in your local machine, the project is binding to I changed it to point only for, changing the pointer in IIS for the IIS site, and deleting the application, and changing the solution properties to look for that address in the local iis.

Everything worked well, so far.

But, when i tried to change it to another hostname, e.g. mysite.com, and if i run the website, i am no longer able to run it properly since i get a runtime exception related with the SiteContext.

It complains in the SiteContext.CurrentSiteName, since it is empty. So, i would like to know from where is the SiteContext loaded in terms of information? Database? And if yes, why a change of binding would break the application?

Also, i noticed that if i use the default binding ( ), running locally, it does not use the Owin Auth class, but if i run it as mysite1.com for example, it will execute the Configuration method in the Startup.Auth class, and this class is using Owin Auth.

So it is kind of forcing the Auth for this different binding.

Could you help me please?

Thank you, HB

Recent Answers

ICT Projects Team answered on April 12, 2017 12:11 (last edited on April 12, 2017 14:50)

0 votesVote for this answer Mark as a Correct answer

Brian McKeiver answered on April 12, 2017 17:44

Hi Damien,

I have run into this issue before. I wish I could completely remember what I did to get around it, but to clarify, are you seeing the error when trying to run the Kentico admin site, or when hitting the MVC site?

I think I might have had to clear the cache and restart the app to get it all working after I changed the name. The other thing I remember having to do is to run VS as a full admin for some reason.

Sorry wish I could be more clear.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.