Monday, February 29, 2016

Hyper V and VMWare on the same machine

If you get, "internal error" while starting a VM, please start "VMware Authorization Service" Service. and try again.
To do this open an Administrator Command Prompt, enter this command and then reboot:
bcdedit /set hypervisorlaunchtype off
Hyper-V can be enabled again with this command (which also requires a reboot):
bcdedit /set hypervisorlaunchtype auto

Ref : https://pricklytech.wordpress.com/2014/02/25/windows-8-1-vmware-player-and-hyper-v-are-not-compatible/

Wednesday, February 24, 2016

Globally Accessible Class

public class GloballyAccessibleClass
    {
        private GloballyAccessibleClass() { }

        public static GloballyAccessibleClass Instance
        {
            get
            {
                IDictionary items = HttpContext.Current.Items;
                if (!items.Contains("PaperSave"))
                {
                    items["PaperSave"] = new GloballyAccessibleClass();
                }
                return items["PaperSave"] as GloballyAccessibleClass;
            }
        }

        //public HostedEnvironment PaperSaveEnvironment { get; set; };

    }

Tuesday, February 23, 2016

IIS Log Viewer

https://www.weblogexpert.com/info/IISLogs.htm

Log Parser

Covert the time

LogParser.exe "SELECT DATE,TO_LOCALTIME(time) AS time,s-ip,cs-method,cs-uri-stem,cs-uri-query,s-port,cs-username,c-ip,cs(User-Agent),sc-status,sc-substatus,sc-win32-status,time-taken INTOc:\ayman\output.log FROM c:\ayman\input.log" -i:IISW3C -o:W3C


Wednesday, February 17, 2016

ADFS 3.0 stops working after reboot

Background :
With the arrival of ADFS 3.0 in Windows Server 2012 R2 the use of IIS with AD FS in Windows Server 2012 R2 has been eschewed in favour of a move to kernel-mode (HTTP.SYS). The motive is to improve performance, provide greater sign-in customization options and to be able for co-locating ADFS and AD Domain Services on the same server (IIS on domain controllers is from a security perspective a big no-no).
As the use of federation services goes more mainstream in everyday use with Windows 8.1, office 365 , intune , azure and whatever cloud service they come up with , this shift is understandable and an important design consideration.  With the new kernel-mode approach, support for running under server core also appears as an option in the new release.
Problem :
In my lab , I Installed and configured ADFS 3.0 om my domain controller with a global managed service account (gmsa). This is a new feature since ADDS 2012 was introduced. After a server reboot , the ADFS services cannot start anymore and it always stay in "starting" state , making your DC unusable.
This issue appears to be gMSA related, when you install ADFS 3.0 on a 2012R2 running AD DS, than after the reboot (not always) gMSA fails to authenticate on behalf of the ADFS Service under which the service is configured to run.
Solution:
After investigation, I found an unacceptable workaround, which is to :
1. Reboot the ADDS/ADFS3.0 server, logon and immediately set the ADFS Service from Automatic (Delayed) to Manual.
2. Change the Microsoft Key Distribution Service (kdssvc) service to auto (instead of manual trigger) and restart the DC.
3. Logon and start the ADFS service (starts successfully)
4. Set the ADFS Service from Manual to Automatic (Delayed) .
5. Done.
Keep it coming. We’re all learning ADFS 3.0 for Windows Intune  :-)

Enable Basic Authentication in IIS Express

go to
%USERPROFILE%\Documents\IISExpress\config\applicationhost.config: 
and then search for basicauthentication in there and set it to true.

<basicAuthentication enabled="true" />


Sunday, January 31, 2016

Change Feature Delegation for IISExpress

IIS EXPRESS - TURNING ON WINDOWS AUTHENTICATION

 
 Posted In: iis
Time to Read: 1 min
So I brought up a new machine and tried to run my ASP.NET web site in IIS Express that uses Windows Authentication and was greeted with the following error:
Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Details:
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=”Deny”), or set explicitly by a location tag with overrideMode=”Deny” or the legacy allowOverride=”false”.

Solution

Every time I bring up a new machine I always forget to update the IIS Express setting to fix this error and have to do a google search to figure out where the IIS Express configuration is stored. So I figured I should finally document the fix for it.
The error is caused by this section in the web.config
<system.webServer>
 <security>
  <authentication>
   <windowsAuthentication enabled="true" />
   <anonymousAuthentication enabled="false" />   
  </authentication>
 </security>
</system.webServer>
To fix this open up the IIS Express applicationhost.config. This file is stored at C:\Users[your user name]\Documents\IISExpress\config\applicationhost.config
Update for VS2015+: config file location is $(solutionDir).vs\config\applicationhost.config
Look for the following lines
<section name="windowsAuthentication" overrideModeDefault="Deny" />
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<add name="WindowsAuthenticationModule" lockItem="true" />
<add name="AnonymousAuthenticationModule" lockItem="true" />
Change those lines to
<section name="windowsAuthentication" overrideModeDefault="Allow" />
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="WindowsAuthenticationModule" lockItem="false" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
Save the file and refresh your asp.net web page. It may take a moment to load as it load the new configurations into IIS Express.

Thanks to :
http://digitaldrummerj.me/iis-express-windows-authentication/