Cannot debug an Azure solution in VS2010 Ultimate and the Azure Emulator

Answered Cannot debug an Azure solution in VS2010 Ultimate and the Azure Emulator

  • Thursday, July 05, 2012 10:50 PM
     
     

    Hello fellow Azurer's.  I am trying to learn Windows Azure and WCF and I am having a problem:  Whenever I try to debug the solution containing a website and a WCF service with an http endpoint I am being unable to get the WCF service working.

    This is what I did, in a nutshell:

    1. Created a new cloud solution.
    2. Added a website and a wcf web role.
    3. I learned to create WCF in dll's so I added to the solution (not through the Azure solution) a WCF class library project and coded the WCF service there.
    4. I created 2 more dll's to adhere to my own standards of tier programming:  One class library definng the Data Layer interfaces, then another one representing the Data Layer itself.  I coded these as usual.  No issues.
    5. Deleted the default service contract provided in the WCF role in Azure and modified Service1.svc to use the service in the DLL.  Also deleted the code-behind.
    6. Ran dsinit /autodetect to use my local installation of SQL Server 2012 as I don't use SQL Express.
    7. Restarted VS2010 as administrator and hit F5.

    Two IE windows open:  One for 127.0.0.1:81 for my website role and 127.0.0.1:8080 for my WCF service.  Well, the latter shows a HTTP error 403:  Forbidden.

    What am I doing wrong?


    Jose R. MCP
    Code Samples

All Replies

  • Friday, July 06, 2012 3:53 AM
    Moderator
     
     Answered

    Hi,

    According to your descritption, you mentioned "One for 127.0.0.1:81 for my website role and 127.0.0.1:8080 for my WCF service.  Well, the latter shows a HTTP error 403:  Forbidden", do you ever set any default page as the startup page in Website and WCF web role, defaultly if you dont set this and view the site without file path (just like http://127.0.0.1:81 ), web server will think you want to browse list of these files, and this operation was forbidden defaultly, this is the one of potential reason cause this exception.

    Another things is you can copy the WCF service url in Browser to make sure your service is deploy OK in local environment, for example, http://127.0.0.1:8080/Service1.svc.

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

  • Friday, July 06, 2012 5:44 AM
     
     

    Thanks Arwind for stopping by.  The 403 appears when no default page is available, true.  So yes, it may be possible that the problem arises because of file listing denial.  But if I set the startup page to that of my service (.svc) I get a 404.

    If I set the WCF web service project as the startup project, the WCF service web page is visible in the browser, but it is now using the web server for Visual Studio, not the Azure emulator, meaning the address is now localhost:56567.  Furthermore, the WCF test client is able to use the mex endpoint and list my service just fine.

    If you want more detail about my setup, please let me know.


    Jose R. MCP
    Code Samples

  • Friday, July 06, 2012 8:26 AM
     
     

    Additional information:

    1. Created a new cloud project with only a WCF role.
    2. Programmed two methods:  Reset() and NextFibonacci().  So yes, the service calculates the Fibonacci sequence.
    3. Compiled.
    4. Edited web.config for the endpoints and such.  They were there already.
    5. Ran the project., 

    IE shows the help page when navigating to 127.0.0.1:81/Fibonacci.svc but strangely enough the link to the WSDL points to my full DNS computer name and port 82.  The link doesn't work.

    I also notice that the Azure Emulator shows http://*:81 in the deployment service details, and I also notice that IIS Express is running a website @ http://127.255.0.0:82 also pointing to the WCF root directory.  So it looks as if the service was available from either URL but none of the URL's work with the WCF Test Client.

    When I try to connect to http://127.0.0.1:81/Fibonacci.svc I get the error:

    Error: Cannot obtain Metadata from http://127.0.0.1:81/Fibonacci.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: http://127.0.0.1:81/Fibonacci.svc    Metadata contains a reference that cannot be resolved: 'http://127.0.0.1:81/Fibonacci.svc'.    Content Type application/soap+xml; charset=utf-8 was not supported by service http://127.0.0.1:81/Fibonacci.svc.  The client and service bindings may be mismatched.    The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error    URI: http://127.0.0.1:81/Fibonacci.svc    The document at the url http://127.0.0.1:81/Fibonacci.svc was not recognized as a known document type.The error message from each known type may help you fix the problem:- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'http://127.0.0.1:81/Fibonacci.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'DISCO Document' is 'There was an error downloading 'http://<my fully qualified workstation name>:82/Fibonacci.svc?disco'.'.  - Unable to connect to the remote server  - No connection could be made because the target machine actively refused it 127.0.0.1:82- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

    Take a look at the bold part.  I investigated and it seems that the service is being run for SOAP messages version 1.1 while the test client is sending a SOAP message v1.2.  How did I get in this predicament?  I honestly don't know.  I just installed the SDK June 2012.  I had the November 2011 previously installed, but the newer installer did not complain.

    If I use the WCF Test Client to connect to http://127.255.0.0:82/Fibonacci.svc then I get the treeview populated as if it worked OK.  BUT:  If I try to run NextFibonacci() it doesn't work and throsw and exception:  

    There was no endpoint listening at http://<my fully qualified workstation name>:82/Fibonacci.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

    So at this point I am very confused.  Why does the Azure debug environment seem to launch the website for the WCF service twice (one via the Windows Azure Compute Emulator and another through IIS Express), and when or how did I get into the SOAP version mismatch?

    To be honest this is very frustrating.  At this rate I will never adopt or recommend Azure to anybody.


    Jose R. MCP
    Code Samples

  • Sunday, July 08, 2012 4:12 PM
    Moderator
     
     

    Hi,

    I guess you may miss useRequestHeadersForMetadataAddress :

    http://msdn.microsoft.com/en-us/library/ee816894.aspx 

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

  • Wednesday, July 18, 2012 8:58 AM
     
     

    Hi,

    If you wish the browser not fired up for one of the WebRoles, then tick off the launch browser setting in the properties of the WebRole.

    Marcel