Archives For visual studio


(I’ve run into these issue enough times that I thought I’d do a quick post about as it can be incredibly frustrating if you don’t know how to resolve this issue.)

As you may know I do a lot of work with Azure and, in particular, the Access Control Service (ACS). I’m a huge fan of ACS because it is a great way to offload authentication and authorization from your web sites. In order secure your web sites with ACS you need to download and install the Windows Identity Foundation (WIF) runtime and sdk. Once installed, you’ll get some nice templates in Visual Studio. You’ll also get a context menu option to add a Secure Token Service (STS) reference to your web site. This is typically what you use to integrated your web sites with ACS (unless you like crafting your web configuration files by hand, which I don’t recommend.)

Every now and then, typically after I install some update or additional tools for Visual Studio, the add STS reference option disappears. As evidences in the picture below.

I can’t replicate the scenario that removes the context menu option from Visual Studio. I just know it’s happened to me 5-6 times.

The resolution is simple enough:

  1. Run the Visual Studio Command Prompt as an administrator
  2. Run the following command: “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv” /ResetAddin Microsoft.IdentityModel.Tools.VS.VSAddin.FederationAddin

After you’ve executed the steps above, open a project containing a web site in Visual Studio, right-click on the project, and you should be good to go:

Hope this helps resolves what can be a very frustrating issue quickly.

ag

 

Windows Azure Tools FAQ

December 13, 2011

Over the past twelve months I’ve conducted a number of Windows Azure Boot Camps  around the country with Microsoft’s Mike Benkovich. One of the biggest challenges we notice developers facing is simply getting all of the necessary components installed and configured so they can start developing for Azure. After the latest boot camp in Tulsa, Alex Culp (a colleague of mine at RBA) decided to put together a FAQ to help folks get up and running.  Below are the most common questions (and answers) we’ve encountered this past year. I hope it helps.

Which versions and editions of Windows are supported for development?

Windows 7 (Ultimate, Professional, and Enterprise Editions)
Windows Server 2008
Windows Server 2008 R2
Windows Vista (Ultimate, Business, and Enterprise Editions) with Service Pack 1 or Service Pack 2

Please note the following operating systems are not supported:
Windows XP
Windows Vista/7 Starter, Home Basic, and Home Premium editions

Why do the Windows Azure SDK and tools for Visual Studio fail to install?

In order to install the Windows Azure SDK and tools for Visual Studio you must install Service Pack 1 for Visual Studio 2010.

How do I change the instance of SQL the Windows Azure storage emulator uses?

You can use the DSInit Command-Line Tool to specify which instance of SQL the Windows Azure storage emulator uses on your development machine. If you installed the Windows Azure SDK in the default location, DSInit can be found at C:\Program Files\Windows Azure SDK\<SDK version>\bin\devstore\. Below is an example of how to use DSInit to configure the Windows Azure storage emulator to use the default (unnamed) instance of SQL Server on the local machine.

  1. Run a command prompt as an administrator.
  2. Change the working directory to C:\Program Files\Windows Azure SDK\<SDK version>\bin\devstore\.
  3. Type the following DSInit /sqlinstance:. /forcecreate
  4. Press Enter

To view the most current option list, type DSInit /? at the command prompt from the installed location.
 
(For more information on DSInit, please refer to this MSDN article: http://msdn.microsoft.com/en-us/library/windowsazure/gg433005.aspx)

What if I receive an error message that one or more ports used by the Compute Emulator are currently used by other processes?

  1. Determine if any of the following ports are being used by a non-Windows service: 15095, 15096, 15097, 15098, 15099, or 15100. You can run netstat –an from the command line to determine which ports are currently in use.
  2. Navigate to the installation directory of the Compute Emulator. By default the Compute Emulator is installed at C:\Program Files\Windows Azure Emulator\emulator\devfabric.
  3. In the DevFc.exe.config file, locate the add port entry that contains the conflicting port value and modify the value to use a non-conflicting port. The DevFc.exe.config file entries that can be affected are:
    <add key=”ManagementServicePort” value=”15095″ />
    <add key=”RepositoryServicePort” value=”15096″ />
    <add key=”AgentCallbackPort” value=”15097″ />
    <add key=”AgentPort” value=”15098″ />
    <add key=”PxeResponderPort” value=”15100″ />
  4. In the DfService.exe.config file, locate the dfservice element and modify the ManagementServicePort or RepositoryServicePort attribute to use a non-conflicting port.
    <dfservice ManagementServicePort=”15095″ RepositoryServicePort=”15096″ />
  5. Press F5 to restart the application or run the CSRun Command-Line Tool.

(For more information see the following MSDN article: http://msdn.microsoft.com/en-us/library/windowsazure/hh472164.aspx)

What if I receive an “Unable to connect to dfService” error message?

There are two potential causes of this problem. The first could be that a non-Windows Azure service is listening on a port Windows Azure requires. To resolve this, take the following steps:

  1. Identify any non-Windows Azure service that is listening on the following ports: 12000, 12001, 12002, 808, 16001, or 15100.
  2. Stop the identified service.
  3. Press F5 to restart the application.

(For more information see the following MSDN article: http://msdn.microsoft.com/en-us/library/windowsazure/hh472164.aspx)
 
The second cause of this issue could be due to a space in the Windows name of the user trying to run the service. To resolve this, take the following steps:

  1. Open a Windows Azure command prompt.
  2. Set the environment variable _CSRUN_STATE_DIRECTORY to a path that does not contain spaces. (For example, _CSRUN_STATE_DIRECTORY=c:\dftemp)
  3. Use CSRun.exe /devfabric:start to start the emulator.

(For more information see the following MSDN article: http://msdn.microsoft.com/en-us/library/windowsazure/hh472165.aspx)

Why can’t I connect to SQL Azure from SQL Server Management Studio?

In order to connect to SQL Azure from SQL Server Management Studio, you need to be running SQL Server Management Studio 2008 R2 (Express or full edition). You can download the Express edition here: http://www.microsoft.com/sqlserver/en/us/editions/express.aspx. Be sure to select the download that includes the tools.
 
In order to connect to SQL Azure you also need to ensure that you’ve configured the SQL Azure firewall to accept traffic from your machine. You can find instructions on how to configure the SQL Azure firewall here: http://msdn.microsoft.com/en-us/library/windowsazure/ee621783.aspx

In this episode I show you what you need to start developing for Windows Azure and gives you a tour of the local development environment.

{Every now and then I find that I have to do some kind of configuration magic to get my development environment working the way I want it to. I promptly forget it until I have to do it again 3-6 months later when I replace my machine. By then I have no idea what I did so I have to look it up again. The point of this Note to Self series is to remind me of exactly what I did so I don’t have to try to remember the name of some odd command line tool and the various parameters that go along with it.}

Let me start by saying that I’m a big fan of Team Foundation Server (TFS). I think the product has come a long way since it’s initial release in 2005. I wish it had some more features that could make it a distributed version control system (i.e. Git and Mercurial), but all in all it’s a good product

With that said, one of the things I’m not a fan of is how Visual Studio (VS) attempts to connect to TFS on startup. There are two specific reasons I don’t like this. First, it slows down VS startup. Second, I have multiple clients, not all of whom expose their TFS instances over http/s. If the last instance of TFS I was connected happens to belong to one of these clients, not only do I have to wait for the long startup, I have to endure a dialog telling me that VS could not connect to TFS. This is especially frustrating when all I want to do is create a simple console app to test out an idea or two. It’s so frustrating, that I’m acutally getting frustrated right now as I write this. Grrrr….

Luckily all is not lost and this no longer needs to be endured. With a small registry tweak you can prevent VS from connecting to TFS (2005, 2008, and 2010) on startup. Here’s what you do:

1. Backup your registry. Don’t skip this step. SERIOUSLY! DON’T SKIP IT!

2. Navigate to Team Foundation key:

For VS 2005 navigate to: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation

For VS 2008 navigate to: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation

For VS 2010 navigate to: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TeamFoundation

3. Add a registry key “AutoLoadServer” (type DWORD)

4. Setting the value to be 0 (Do not connect automatically or 1 to connect automatically).

This has made me a happier, well less frustrated, developer. I hope it does the same for you.