A personal repository of technical notes. - CSC

Could not open a connection to SQL Server in ASP.NET on Windows 7 x64 IIS 7

Problem

While developing an ASP.NET website on a local Windows 7 x64 IIS 7 machine, received the following error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

However, a connection could be opened using SQL Server Management Studio (SSMS) with the same credentials used by the website.

Solution

Set up server alias in 64-bit version of SQL Native Client Configuration using Sql Server Configuration Manager. The reason that SSMS was working was because it was using the 32-bit aliases set up at an earlier time.

Missing System.Web.Extensions Reference in Windows 7 x64 VS2010

Problem

Unable to compile an ASP.NET 2.0 project in Visual Studio 2010 on Windows 7 x64 that references System.Web.Extensions (ASP.NET AJAX 1.0). The following errors were thrown:

c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "MyClass, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "MyClass, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".

c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3267: The primary reference "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL".


Solution

1) Installed ASP.NET AJAX 1.0:

Download Details - Microsoft Download Center - ASP.NET AJAX 1.0
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=883

However, could not add a reference to System.Web.Extensions even though it was installed:


2) Had to manually add the following registry entry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ASP.NET AJAX Extensions]
@="C:\\Program Files (x86)\\Microsoft ASP.NET\\ASP.NET 2.0 AJAX Extensions\\v1.0.61025\\"


Could then add a reference to System.Web.Extensions:



References

"MSBUILD 4.0 Fails on AJAX Extensions." Visual Studio 2010 - MSBUILD 4.0 Fails on AJAX Extensions - Stack Overflow. 3 June 2010. Web. 26 July 2011.
<http://stackoverflow.com/questions/2966769/msbuild-4-0-fails-on-ajax-extensions>.

Windows SendTo Folder

Location (Windows 7)
C:\Users\MyUserName\AppData\Roaming\Microsoft\Windows\SendTo
or
%APPDATA%\Microsoft\Windows\SendTo
or
shell:sendto

Location (Windows XP)
C:\Documents and Settings\MyUserName\SendTo
or
%USERPROFILE%\SendTo
or
shell:sendto

Tip to Open SendTo Folder (Windows 7, XP)
1) Create a text file in SendTo folder called "Open SendTo Folder.bat".
2) Add the following line:
start explorer.exe shell:SendTo
3) To quickly open SendTo folder while using the right-click/Send to feature, click on "Open SendTo Folder.bat".