A Blog of a Work from Home Breadwinner. Blogging anything under the sun since college days.

Learning Kentico: Localhost problem (port number is in use & error 401.2)

Back to learning Kentico and this time, my local copy stopped working. Just weird. I encountered this  HTTP error 401.2 - Unauthorized issue. This was all working fine for the past few days/month but now it stopped working. What the fudge!

And last Monday also, I encountered this port number is in use issue. I couldn't run both local copies of a test/practice site that I'm working - running in Visual Studio 2013 (for Kentico 10) and the other one is Visual Studio 2017 (for Kentico 11). I think I visited almost all sites suggesting solutions but I couldn't fix it. Jaahhhh...
port number is in use
port number is in use issue (click image to enlarge)

And I was having a hard time finding that dynamic ports that they were saying.  I need to set it to False so I can enable editing the Port number properly. But it seems not showing really in my Visual Studio, take a look below:

dynamic ports in visual studio
How to enable this?  (click image to enlarge)

So I decided to ignore it because I have spent a lot of hours trying to resolve the issue already.  I told myself that I will just get back to it when I have more time. Besides, both are working. It's just that I can't run them at the same time.

And today,  as I've mentioned earlier - new issue arise! I don't know what happened but I need to fix it. 

error 401.2 - unauthorized
error 401.2 - unauthorized (click image to enlarge)

So consulted Google as always, and these are the solutions that I have tried.

1. Check if Windows Authentication Module is enabled in IIS Manager - done

windows authentication module
windows authentication module (click image to enlarge)

2. Check if Anonymous Authenticated is enabled in IIS Manager - done 

anonymous authentication
anonymous authentication (click image to enlarge)

3. Check if I Windows Authenticated mode is ticked in Windows Feature - done
windows feature authentication
I came to a point also where I checked if I have enabled ASP.Net in the Application Development Features. (This is still in Windows Features -> Internet Information Services -> World Wide Services).

And I also came across  a solution saying deleting a duplicate web config file (as they said I must have two copies of it). And yeah, I really deleted it that I encountered a lot of errors. I found a web config file outside my Kentico 11 folder and inside my CMS folder. And the two become that web config file inside the Admin folder. Take note: they are different! It's a no, no! Don't delete. It will not work. Good thing, I was able to fix all the issues. 

web config file

But the error 401.2 is still not fixed. My hands are already sweating and my eyes are so tired. So I took a rest for a while (washed my coffee cup and restarted my computer). Then, I tried running my back-up copy of Kentico 11. And suddenly that local copy is working. Whatta! (Yes, it was not working also) I also got a notification that I need to change my localhost port number. This time, I need to edit it in Kentico CMS Desk. And yes, I was able to edit it. 

edit local host port number
Edit local host port number (click image to enlarge)
So if I was able to changed it now (through CMS desk) then I can now run my Kentico 10 (VS Express 2013) site - and so I did :) 

I don't really remember why it worked but I think I accidentally found the culprit. In the Properties window, the Anonymous Authentication was set to Disabled and as well as the Windows Authentication. Gossshh..I'm so noob. So guys, make sure to check these and enable these two also. This is the number 4 step

enable windows and anonymous authentication
Enable Windows and Anonymous Authentication (click image to enlarge)

And viola! All is good now. Phew! What a long post! And what a tiring and fulfilling day it is! :) 


No comments:

Post a Comment