Category: Development

  • How to install DotNet 2.0 or 3.5 on Windows 10

    Updated on 2015/10/4: Update the screenshots to Windows 10, however, applies to Windows 8/8.1/10

    Windows 10 includes the 2.0, 3.5 and 4.5 versions of the .NET Framework. However, only 4.5 is available for immediate use after a clean install. The versions 2.0 and 3.5 of the framework are not installed by default. If you open the Add/Remove Windows Features dialog you’ll see the “Microsoft .NET Framework 3.5 (includes .NET 2.0 and 3.0)” listed, but disabled.

    (more…)

  • Kentico CMS Installation issues troubleshooting – SQL Server Connection problems

    You may encounter problems when entering the database connection details in the first step of database setup:

    image

    (more…)

  • HTTP Error 404.13 – Not Found Error When Upload Big File using WCF

    On IIS 7.5, if you upload big file thru WCF service, you might get http 404.13 error from IIS server.

    HTTP Error 404.13 – Not Found
    The request filtering module is configured to deny a request that exceeds the request content length.

    The solution is set a higher value for maxAllowedContentLength in web.config of application

    <configuration>
    <system.webServer>
    <security>
    <requestFiltering>
    <requestLimits maxAllowedContentLength="300000000"/>
    </requestFiltering>
    </security>
    </system.webServer>
    </configuration>

  • Generate GUID in PERL

    It’s very common for developer to generate a GUID in code to guarantee uniqueness. Here is the sample code to generate a GUID in Perl

    my $guid = `uuidgen.exe`;
    chomp $guid;

    Uuuidgen.exe is a tool from DotNet Framework. You can append "-c" option to generate uppercase letters

    Run uuidgen /? to see the detail usage of uuidgen.
    Microsoft UUID Generator v1.01 Copyright (c) Microsoft Corporation. All rights reserved.

    usage: uuidgen [-xisconvh?]
            x – Generate sequential (V1) UUIDs
            i – Output UUID in an IDL interface template
            s – Output UUID as an initialized C struct
            c – Output UUID in upper case
            o<filename> – redirect output to a file, specified immediately after o
            n<number> – Number of UUIDs to generate, specified immediately after n
            v – display version information about uuidgen
            h,? – Display command option summary

  • MSBUILD Reserved Properties

    When you use MSBuild, a handful of properties are available to you out of the box that cannot be modified. These are known as reserved properties. Following table presents all reserved properties in MSBuild 4.

    (more…)

  • IIS 7.5 Error The temp directory in chart handler configuration is not accessible

    If you build a web application with Chart control for ASP.NET 4.0 and deploy the site to web server.  You might get following error on the live site:

    The temp directory in chart handler configuration is not accessible

    To resolve this, first go to web.config and find the ChartImage directory in appsettings.

    <appSettings>
    <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:TempImageFiles;" />
    </appSettings>

    The go to the temp chart image directory and grant read and write permission to IIS working process account in share properties – security tab. Note that the account runs IIS working process is different between IIS 7 and IIS 7.5

    • On Windows Server 2008 has IIS7, grant Read and Write permission to Network Service
    • On Windows server 2008 R2 has IIS 7.5, grant Read and Write permission to AppPool<PoolName>. Replace <PoolName> to the actual machine pool your site is running on, for example, if your site is running on pool named ASP.NET v4.0, then the account you need grant permission would be IIS AppPoolASP.NET v4.0, you can refer this step by step instructions for detail
  • Remove dead using statements

    Visual Studio has a great feature to easily remove all dead using statements in your code.

    The steps are pretty straightforward.

    1. Right click anywhere from the code
    2. Select Organize Using and
    3. Select Remove Unused Usings.

    image

  • Could not load file or assembly TraceWrapper, Version=1.0.523.0

    There are two versions of the TraceWrapper.dll in SCVMM install CD. One is x86 version and the other is x64 version. When you build your application on top of SCVMM library Microsoft.SystemCenter.VirtualMachineManager, it’s very important to pick up the correct version TraceWrapper.dll. In general, you should copy the 32 bit dll if you are using 32 bit system, copy 64 bit dll if you are using 64 bit system. Otherwise following BadImageFormatException would occur during runtime.

    Could not load file or assembly ‘TraceWrapper, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

    However, you should keep using 32 bit TraceWrapper on a 64 bit system for following scenarios:

    • You need debug your app in Visual Studio directly. In this case, process launched from Visual Studio debugger runs in WOW64 mode.
    • IIS is configured to run in 32 bit mode. In this case, all working processes run in WOW64 mode.

    This is because in 64 bit windows, processes in WOW64 mode are 32 bit processes and can’t load 64 bit TraceWrapper.dll.

  • CSharp – Get Assembly and File Version

    If you want to know the version of currently executing managed assembly, you can use Reflection.Assembly.

    Here is code snippet which can be used to do get managed assembly version.

    private string GetVersion()
    {
          return Assembly.GetExecutingAssembly().GetName().Version.ToString();
    }