.net

Visual Studio 2012 + .NET 4.5 causes connection to SQL Server to reset

So this is my second attempt to install Visual Studio 2012. After installing i fired up my project in Visual Studio 2010 to continue development as normal, but when entity framework attempts to connect to SQL 2008, it times out with the error:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake.”

After a couple hours of pulling my hair out. I found a very simple fix!

Fire up your command console (with Administrative privileges) and run the command:

netsh Winsock reset

You may have to restart your computer to complete the reset.

I was able to find the solution on:

http://social.msdn.microsoft.com/Forums/en-NZ/vssetup/thread/2d11b6f9-3ada-4682-b643-c721a97af4ba

By |January 31st, 2013|Coding|0 Comments

.NET MVC is now open source

Microsoft has made .NET MVC and Razor open source. Check out the project on Codeplex.

By |March 28th, 2012|Coding|0 Comments

nLog and WCF Service

Recently we deployed a new WCF web service app but quickly noticed nLog didn’t work on our production IIS stack.

We checked permissions on the log folder, checked for errors in the nLog configuration file. All with no luck.

We then noticed the nLog configuration file when deployed was located in the bin folder. We simply moved the configuration file from the bin to the root folder of the web service, restarted the IIS website and it started working. This has been a very tricky problem for us to solve but we wanted to share it with other web developers that may come across this problem in the future.

By |July 19th, 2011|Coding|0 Comments

ReSharper 6 is out: JavaScript/CSS/Razor support, new refactorings, code inspections and more!

ReSharper 6 is out: JavaScript/CSS/Razor support, new refactorings, code inspections and more!

By |July 11th, 2011|Coding, Uncategorized|0 Comments

Generating Entity Framework Code first from an existing database

Generating Entity Framework Code first from an existing database

By |July 8th, 2011|Coding|0 Comments

Visual Studio 2010 SP 1

Visual Studio 2010 SP 1

By |March 12th, 2011|Coding, Uncategorized|0 Comments

Using System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(“/”)

If you are using WebConfigurationManager to retrieve your dbase connection strings please make note of one very important character:

System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(“/”)

I spent about 30 mins trying to track down the problem. I was able to read my connection strings on my local machine but not on production. What gives?

On our production environment the app was deployed as a virtual application. The code above would attempt to read from the default website the virtual app is running under.

If you wish to always retrieve the connection strings from your current app domain make sure to use (notice the tilde):

System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(“~”)

By |March 10th, 2011|Coding, Uncategorized|0 Comments

Creating a nuGet package

Creating a nuGet package

By |February 23rd, 2011|Coding, Uncategorized|0 Comments

Using ResolveClientUrl in MasterPage

A couple weeks ago I tried using ResolveClientUrl in my masterpage to properly link my javascript and CSS files in my MasterPage. When attempting to run the code:

<script src=’<%= ResolveClientUrl(“~/Assets/Includes/Javascript/jquery-1.4.2.min.js”) %>’ type=”text/javascript”></script>

I received a nasty error:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).

What?!? Well after some research I found an alternative solution using databinding, here are the steps I used to remedy the problem:

  1. Change your server side tags from <%=to <%#

    Example: <script src=’<%# ResolveClientUrl(“~/Assets/Includes/Javascript/jquery-1.4.2.min.js”) %>’ type=”text/javascript”></script>

  2. On the Master Page code behind in the Page_Load event place the following snippet of code:

    Page.Header.DataBind(); 

This should take care of the problem, if you are still having issues tweet me: @tekguy.

By |February 22nd, 2011|Coding, Uncategorized|0 Comments

Could not load file or assembly ‘System.Web.Mvc’

So I published my first MVC project today to my production server. I got this error:

Parser Error Message: Could not load file or assembly ‘System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35’ or one of its dependencies. The system cannot find the file specified.

After some quick research the solution was simple and obvious. Upon publishing the assemebly System.Web.Mvc.dll was not placed into the bin folder. We have two options:

1). Find the DLL in your project folder and copy it to the production server
2). Set the “Copy Local” property on the DLL to TRUE. This can be done by browsing to the References folder in the Web project, clicking on System.Web.Mvc and pulling up the properties, select the property “Copy Local” and make sure its set to True. Perform another publish and you should be ready to go!

By |January 4th, 2011|Coding, Uncategorized|0 Comments