Used Visual Studio 2010 to publish a web method that is consumed by Silverlight 4.

Discussion in 'Silverlight' started by PJ2010, Nov 2, 2011.

  1. I ported a Silverlight 3 Solution with a MS SQL Server 2008 database and a web service hosted by Discountasp to Silverlight 4, compiled under Visual Studio 2010.

    Lots of little pitfalls, but I'll mention just a few.

    I have two domains hosted by DASP, one for Visual Studio 2008 projects and one for Visual Studio 2010 projects, so if you only have one domain you might have other problems porting.

    I used the protocol of this thread for the most part: http://community.discountasp.net/showthread.php?t=7719

    The protocol in addition was: debug under localhost (Cassini) until all is fine, with the web methods residing on their own folder locally; then move the MS SQL server 2008 database to DASP, attach your solution to it, then recompile and test again until everything is fine; then move the SOAP web services to DASP (making sure to tweak the web.config file of course), delete the client side web Service Reference, point Visual Studio via right-click to the web services .SVC file, recompile (so now everything should work again fine); and finally, in a new twist, make sure your root domain at DASP has one of these two files (I picked the first one): http://msdn.microsoft.com/en-us/library/cc197955(v=vs.95).aspx (this is a new format that was not present in this same format in Visual Studio 2008 Silverlight 3)

    Everything works fine now. There are other little things you have to do such as set debug to false, etc, but the above is overall the big picture.
     
  2. Coda: be afraid of Visual Studio 2010 publish feature, web deploy

    Beware of Web Deploy, a new feature of Visual Studio 2010 "Publish". It does not work well.

    I spent half a day trying to see why in the morning I could use it then later in the afternoon I could not, despite doing the exact same things. See references below and the error message below. Solution: as pointed out by a user, simply reboot! That's if you are lucky. Other solutions offered include playing with the Windows Registry. Hope Microsoft fixes this bug in the future.

    PJ2010

    http://stackoverflow.com/questions/4428562/msdeploy-web-deploy-failing-with-401-auth-issues

    http://forums.iis.net/t/1162122.aspx (a solution suggested: reboot your PC)


    Error 1 Web deployment task failed.(Remote agent (URL https://eweb704.discountasp.net:8172/MsDeploy.axd?site=MYWEBSITENAME) could not be contacted. Make sure the remote agent service is installed and started on the target computer.)
    Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator.
    Error details:
    Remote agent (URL https://eweb704.discountasp.net:8172/MsDeploy.axd?site=MYWEBSITENAME) could not be contacted. Make sure the remote agent service is installed and started on the target computer.
    An unsupported response was received. The response header 'MSDeploy.Response' was '' but 'v1' was expected.
    The remote server returned an error: (401) Unauthorized. 0 0 SLdb2.Web
     
  3. One more gotcha with Silverlight as a web service client

    This will only make sense to Silverlight programmers, but if the client consuming the web service is a Silverlight client, it is best placed in the same directory as the web service, to avoid any possibility of cross-policy confusion. Of course you still need the files referenced in this thread in your root to avoid any cross-domain access file errors. Further, the client files comprise .xap files (typically one, found in /Bin/Release or similar directory) and the Silverlight TestPage.html, which can be renamed to anything you want to make a better sounding URL. For some strange reason my TestPage.html ended up in the web method project of the Solution, which was a separate folder, and I hand to hunt to find it. Such is modern programming--a trap for the unwary.

    Good luck.
     

Share This Page