none
Identity Developer Training Kit on Windows 7: Unable to start debugging on the web server. The underlying connection was closed: An unexpected error occurred on a send.

    Question

  • I just installed the Identity Developer Training Kit (PDC 2009) on Windows 7 - 64 bit and encountered a problem attempting the first exercise.

     

    PROBLEM

    I could not get past Exercise 1, Task 1, Step 3 of the Identity Developer Training Kit (PDC 2009).

     

    When I pressed F5 to run the Web Site, Visual Studio reported the following error:

    Unable to start debugging on the web server.  The underlying connection was closed:  An unexpected error occurred on a send.

     

    REASON FOR PROBLEM

    The error occurred because the server certificate generated by the SetupLab.cmd was not successfully getting installed

     

    There seems to be a bug in the SetupCertificates.cmd script that prevents the script from calling NETSH.EXE on Windows 7.  The bug causes the script to incorrectly call HTTPCFG.EXE (which does not exist in Windows 7).  The certificate is not setup and the lab exercise fails.

     

    Below is the excerpt from the script that is incorrect. It was copied from  \Labs\WebSitesAndIdentity\Source\Setup\Scripts\SetupCertificates.cmd.

    Notice that it only checks for Windows Vista OS and does not take into account Windows 7 OS…which also requires NETSH to be called. 

     

    @if ("%IsVista%" == "true") (

                    set IsWinClient=true)

     

    @if ("%IsWinClient%" == "true") (

       ECHO Setting up SSL at port 443 using localhost certificate...

       netsh http add sslcert ipport=0.0.0.0:443 appid={00000000-0000-0000-0000-000000000000} certhash=%CERTHASH% clientcertnegotiation=enable

    ) else (

       ECHO Importing server certificate and point HTTP.SYS at it...

       httpcfg.exe set ssl -i 0.0.0.0:443 -f 2 -h %CERTHASH%

    )

     

    WORK AROUND

    To work around the issue I replaced

     

    @if ("%IsWinClient%" == "true") (

       ECHO Setting up SSL at port 443 using localhost certificate...

       netsh http add sslcert ipport=0.0.0.0:443 appid={00000000-0000-0000-0000-000000000000} certhash=%CERTHASH% clientcertnegotiation=enable

    ) else (

       ECHO Importing server certificate and point HTTP.SYS at it...

       httpcfg.exe set ssl -i 0.0.0.0:443 -f 2 -h %CERTHASH%

    )

     

    With

     

       ECHO Setting up SSL at port 443 using localhost certificate...

       netsh http add sslcert ipport=0.0.0.0:443 appid={00000000-0000-0000-0000-000000000000} certhash=%CERTHASH% clientcertnegotiation=enable

     

    This seemed to address the problem by forcing the NETSH.EXE to be called.

    QUESTION
    I have not done a lot of ASP.NET programming or SSL work.  I am just wondering if the above workaround is correct?   Has anyone else successfully run the Lab on Windows 7 without requiring the above workaround? 

    Thanks for considering my question.

    Thursday, December 03, 2009 3:15 PM

All replies

  • I removed parenthesis in IF statement @if ("%IsWinClient%" == "true") ( at line 75 so it looks like this: @if "%IsWinClient%" == "true" (. This way the condition is correctly evaluated and executes the Windows 7 netsh command. I don't know why it is not working with thouse parenthesis...
    -- MCPD Web Applications
    Sunday, December 20, 2009 9:20 PM
  • I got initially same problem or message in Windows 7 (Ultimate x64) environment after completing the installation of the SDK and June 2010 version of Training kit. I tought oh my, another training kit that gives you more trouble than information. But once I work out my environment I got it working smoothly.

    Not sure, if the reason is that I ran the initial setup by none-elevated rights and I got it all wrong (Although it did pass all tests) or if the past WCF and IIS 7 training kits caused some problems.

    I had a clue on this as I saw that it requires http activation feature to be on and I had only installed non-http activation feature on Win7 for another lab.  Althought it did pass the test for http activation, which was not installed.

    Nevertheless, I removed IIS/WCF Service Activation for Non Http restarted and selected these features again including http activation. Once I rreinstalled training kit folder, (removed previously installed IIS folder) and ran the end to end samples they all were working and the lab was pleasant to follow.

    Hope above helps.

    Alexander

    Friday, October 01, 2010 2:20 PM