Sofweb Development Blog

Sharp Architecture New Project wizard is incompatible with AnkhSVN

Posted: Tue 7 Sep, 2010

If you have AnkhSVN installed and you are using Sharp Architecture, you will be unable to create a new Sharp Project using File->New in Visual Studio.  Instead you will get the following error:

---------------------------
Microsoft Visual Studio
---------------------------
A problem was encountered creating the sub project 'sharp.Core'. A project with that name is already opened in the solution.
---------------------------
OK
---------------------------

The work-around for the time being is to uninstall AnkhSVN.  This problem also exists with older versions of SmartSVN.  

 

SQL Server DateTime precision and NHibernate

Posted: Fri 3 Sep, 2010

When storing a DateTime value into SQL server via NHibernate, you'll likely be storing the value in a column with the DateTime data type.  

This is fine for many purposes, however if  you take note of the Ticks property of a c# DateTime variable before saving to the database, and after getting it back out, you will notice that the values are different and you have lost some precision.

It is possible to overcome this by using the DateTime2 data type introduced in SQL Server 2008 (NHibernate supports this via the 2008 dialect) or by storing the value as a BigInt. 

 

Windows server 2008 R2 File Sharing and the Firewall

Posted: Mon 23 Aug, 2010

We recently discovered some unexpected behaviour in Windows Server 2008 R2.  If you share a folder, then windows will automatically, and without any warning, open up the file and printer sharing ports in the windows firewall. The problem is that it opens up the ports to all network profiles, including the public one.  This means that you are opening your file shares to the mercy of the internet (and it's less scrupulous denizens), without even realising it.

It would make more sense if the firewall only opened up the ports to private networks,  which is our case was a VPN, and if it told you what it was about to do.

Reference:  http://technet.microsoft.com/en-us/library/cc731402.aspx

 

Setting up a friendly URL for Confluence using IIS7 Url Rewriting

Posted: Mon 23 Aug, 2010

We recently installed Confluence (from Atlassian) onto one of our servers.  Confluence runs its own web server, and since we already have IIS running on port 80 (as standard on a Windows Server OS), we configured Confluence to run on a diferrent port.  One thing we don't like however, and which our non-technical staff especially hate, is having to remember port numbers (in this case port 8081) when typing a browser address. The IIS 7 URL Rewrite module is a solution which allows us to transparently forward requests on the standard port 80 to another port.

For example if your Confluence installation runs on http://localhost:8081, you can set up an address like http://confluence.mydomain.com to access it using URL Rewriting.

  1. Install the module (link above).
  2. Create a DNS entry for your site, e.g. confluence.mydomain.com -> web server IP address.
  3. Create a folder in wwwroot for your website
  4. Set up a web site in IIS7 manager as you normally would, pointing to that folder.  Set up binding for confluence.mydomain.com
  5. You can configure the URL rewriting settings via the GUI, or you can edit them via a web.config, which is placed in the root folder of the site.  The web.config I use is given below.
  6. When you create a document in confluence that has spaces in the name, it will substitute +'s for the spaces in the URL.  By default IIS won't process this properly as it is viewed as a security risk.  Instead you will see a 404 error if you view the site remotely, or a more informative 404.11 if you try locally. Nonetheless we need to disable this behaviour for our Confluence redirect to get it working properly.  You can open up the Request Filtering section, click on the 'Edit Feature Settings' link, then tick 'Allow double escaping', or if you use the web.config below it is already set.

At this point you should be able to check and see if it is all working by browsing to your site, e.g. http://confluence.mydomain.com

If you are having trouble setting up your URL Rewriting, it is useful to know that there is a way to view a comprehensive trace of the process, follow this link for details.

Sample extract of a working web.config:



<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Reverse Proxy to confluence" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <action type="Rewrite" url="http://localhost:8081/{R:1}" logRewrittenUrl="true" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="*8081*" negate="true" />
                    </conditions>
                </rule>
            </rules>
        </rewrite>
        <security>
            <requestFiltering allowDoubleEscaping="true">
                <requestLimits maxUrl="4096" maxQueryString="2048" />
            </requestFiltering>
        </security>
    </system.webServer>
</configuration>

 

Microsoft Security Essentials breaks SVN

Posted: Mon 16 Aug, 2010

There is an incompatibility with Tortoise SVN and Microsoft Security Essentials.  With MSE turned on, you may experience file corruption errors upon SVN checkin.  As a temporary fix, disabling the realtime scan fixes this problem.  Installing this hotfix appears to fix this problem.

Further information here.