Internet Information Services IIS 8.5: What’s New in Window Server 2012 R2

With the release of the new version of Windows Server 2012 R2 comes a new version of IIS, IIS 8.5.  The new features can be broken into 2 categories, Scalability and Manageability:
  • Manageability - Logging Enhancements
  • Manageability - ETW Events
  • Scalability - Dynamic site activation
  • Scalability - Idle Worker Process Page-out
The following article contains a brief explanation of the new features.  For a very nice and more in-depth walk through of these new features, access the information by watching this Channel9 video “Internet Information Services: What’s New in Window Server 2012 R2 Internet Information Services: What’s New in Window Server 2012 R2” here.

Dynamic site activation

When you are hosting a lot of web sites (100s) in IIS version 6/7/7.5, you may have experienced some noticable time when loading the IIS configuration file.  When WAS runs it will load the configuration for all web sites hosted on the server.  In IIS 8.5 a new more optimized process has been implemented to improve the performance of this activity.  Note: There were also many improvements in this area found in IIS 8.0.


IIS 8.5 Preview Download

Lookup SPF record in C#

We have retrieved already MX and SRV records. Now let's take SPF record from DNS server. SPF string is TXT record(s) and if you are looking for google.com record proceed with
nslookup -type=TXT google.com

Csharp class looks like

public class nDnsQuery
    {
        public nDnsQuery()
        {
        }

        [DllImport("dnsapi", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
        private static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)]ref string pszName, QueryTypes wType, QueryOptions options, int aipServers, ref IntPtr ppQueryResults, int pReserved);

        [DllImport("dnsapi", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern void DnsRecordListFree(IntPtr pRecordList, int FreeType);

  

        public static string[] GetSPFRecords(string domain)
        {

            IntPtr ptr1 = IntPtr.Zero;
            IntPtr ptr2 = IntPtr.Zero;
            SPFRecord recSPF;
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                throw new NotSupportedException();
            }
            ArrayList list1 = new ArrayList();
            try
            {

                int num1 = nDnsQuery.DnsQuery(ref domain, QueryTypes.DNS_TYPE_TEXT, QueryOptions.DNS_QUERY_BYPASS_CACHE, 0, ref ptr1, 0);
                if (num1 != 0)
                {
                    if (num1 == 9003)
                    {
                        list1.Add("DNS record does not exist");
                    }
                    else
                    {
                        throw new Win32Exception(num1);
                    }
                }
                for (ptr2 = ptr1; !ptr2.Equals(IntPtr.Zero); ptr2 = recSPF.pNext)
                {
                    recSPF = (SPFRecord)Marshal.PtrToStructure(ptr2, typeof(SPFRecord));
                    if (recSPF.wType == (ushort)QueryTypes.DNS_TYPE_TEXT)
                    {
                        for (int i = 0; i < recSPF.dwStringCount; i++)
                        {
                            IntPtr pString = recSPF.pStringArray + i;
                            string text1 = Marshal.PtrToStringAuto(pString);
                            if (text1.Contains("v=spf1") || text1.Contains("spf2.0"))
                            {
                                list1.Add(text1);
                            }
                        }
                    }
                }
            }
            finally
            {
                nDnsQuery.DnsRecordListFree(ptr1, 0);
            }
            return (string[])list1.ToArray(typeof(string));
        }

        private enum QueryOptions
        {
            DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE = 1,
            DNS_QUERY_BYPASS_CACHE = 8,
            DNS_QUERY_DONT_RESET_TTL_VALUES = 0x100000,
            DNS_QUERY_NO_HOSTS_FILE = 0x40,
            DNS_QUERY_NO_LOCAL_NAME = 0x20,
            DNS_QUERY_NO_NETBT = 0x80,
            DNS_QUERY_NO_RECURSION = 4,
            DNS_QUERY_NO_WIRE_QUERY = 0x10,
            DNS_QUERY_RESERVED = -16777216,
            DNS_QUERY_RETURN_MESSAGE = 0x200,
            DNS_QUERY_STANDARD = 0,
            DNS_QUERY_TREAT_AS_FQDN = 0x1000,
            DNS_QUERY_USE_TCP_ONLY = 2,
            DNS_QUERY_WIRE_ONLY = 0x100
        }

        private enum QueryTypes
        {
            DNS_TYPE_A = 0x0001,
            DNS_TYPE_MX = 0x000f,
            DNS_TYPE_TEXT = 0x0010,
            DNS_TYPE_SRV = 0x0021
        }

  

        [StructLayout(LayoutKind.Sequential)]
        private struct SPFRecord
        {
            public IntPtr pNext;
            public string pName;
            public ushort wType;
            public ushort wDataLength;
            public int flags;
            public int dwTtl;
            public int dwReserved;
            public Int32 dwStringCount;
            public IntPtr pStringArray;
        }

    }

You can take full sources here.

Enjoy!

Lookup SRV record in C#

Similar to MX lookup, we can use WINAPI DnsQuery from csharp to complete DNS SRV request.
You can take sources here.

public class nDnsQuery
    {
        public nDnsQuery()
        {
        }

        [DllImport("dnsapi", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
        private static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)]ref string pszName, QueryTypes wType, QueryOptions options, int aipServers, ref IntPtr ppQueryResults, int pReserved);

        [DllImport("dnsapi", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern void DnsRecordListFree(IntPtr pRecordList, int FreeType);

  
        public static string[] GetSRVRecords(string needle)
        {

            IntPtr ptr1 = IntPtr.Zero;
            IntPtr ptr2 = IntPtr.Zero;
            SRVRecord recSRV;
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                throw new NotSupportedException();
            }
            ArrayList list1 = new ArrayList();
            try
            {

                int num1 = nDnsQuery.DnsQuery(ref needle, QueryTypes.DNS_TYPE_SRV, QueryOptions.DNS_QUERY_BYPASS_CACHE, 0, ref ptr1, 0);
                if (num1 != 0)
                {
                    if (num1 == 9003)
                    {
                        list1.Add("DNS record does not exist");
                    }
                    else
                    {
                        throw new Win32Exception(num1);
                    }
                }
                for (ptr2 = ptr1; !ptr2.Equals(IntPtr.Zero); ptr2 = recSRV.pNext)
                {
                    recSRV = (SRVRecord)Marshal.PtrToStructure(ptr2, typeof(SRVRecord));
                    if (recSRV.wType == (ushort)QueryTypes.DNS_TYPE_SRV)
                    {
                        string text1 = Marshal.PtrToStringAuto(recSRV.pNameTarget);
                        text1 += ":" + recSRV.wPort;
                        list1.Add(text1);
                    }
                }
            }
            finally
            {
                nDnsQuery.DnsRecordListFree(ptr1, 0);
            }
            return (string[])list1.ToArray(typeof(string));
        }

        private enum QueryOptions
        {
            DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE = 1,
            DNS_QUERY_BYPASS_CACHE = 8,
            DNS_QUERY_DONT_RESET_TTL_VALUES = 0x100000,
            DNS_QUERY_NO_HOSTS_FILE = 0x40,
            DNS_QUERY_NO_LOCAL_NAME = 0x20,
            DNS_QUERY_NO_NETBT = 0x80,
            DNS_QUERY_NO_RECURSION = 4,
            DNS_QUERY_NO_WIRE_QUERY = 0x10,
            DNS_QUERY_RESERVED = -16777216,
            DNS_QUERY_RETURN_MESSAGE = 0x200,
            DNS_QUERY_STANDARD = 0,
            DNS_QUERY_TREAT_AS_FQDN = 0x1000,
            DNS_QUERY_USE_TCP_ONLY = 2,
            DNS_QUERY_WIRE_ONLY = 0x100
        }

        private enum QueryTypes
        {
            DNS_TYPE_A = 0x0001,
            DNS_TYPE_MX = 0x000f,
            DNS_TYPE_SRV = 0x0021
        }

  
        [StructLayout(LayoutKind.Sequential)]
        private struct SRVRecord
        {
            public IntPtr pNext;
            public string pName;
            public ushort wType;
            public ushort wDataLength;
            public int flags;
            public int dwTtl;
            public int dwReserved;
            public IntPtr pNameTarget;
            public ushort wPriority;
            public ushort wWeight;
            public ushort wPort;
            public ushort Pad;
        }
    }
Enjoy!

HOWTO create php function list

I have tried to use php reflections with no success to examine php class.
After that i found phpdoc which creates full list of methods etc just in a second.
It was really easy against expectation. And now I can see php function list nice formated

$ phpdoc -o HTML:frames:earthli -d -myclasses -t docs

and result looks like



Enjoy!

HOWTO list all my java class methods

Similar to C# function list, you can list java class or jar file details.
I have written small utility to find all methods using java reflection.

Please note it uses platform depended SWT library.
Windows: javaFunctions_x86_win32.jar
Linux: javaFunctions_linux.jar

Result can be

Enjoy!

C# real function list

An assembly (DLL, EXE etc) can contain different classes. And class can contain a lot of methods.
You know already about reflection, but you need quickly look up the function list.

I have written yet another c sharp assembly explorer, please take here.




Enjoy!

OTRS Only tickets are shown in queues where agents have "rw" permission

OTRS - Hat ein Benutzer nur Leserechte (ro) auf eine Queue werden keine Tickets angezeigt
user with readonly (RO) permissions can find tickets, but can't see tickets by default in AgentQueueView because tickets are not listed.
To resolve the issue search in SysConfig for ViewAllPossibleTickets and set 

Ticket::Frontend::AgentTicketQueue###ViewAllPossibleTickets to Yes.

$Self->{'Ticket::Frontend::AgentTicketQueue'}->{'ViewAllPossibleTickets'} =  '1';


Enjoy!

Asterisk AST_SORCERY function

 AST_SORCERY gets a field from a sorcery object. Sorcery is always created for PJSIP aors, endpoints and identifies in asterisk. It allows y...