Unable to Connect to Silverlight Application
PROBLEM
You cannot record your Silverlight application through Test Studio and receive an "Unable to connect" error message.
KNOWN ISSUES
SOLUTION
- Make sure that you have registered the .XAP file extension within IIS. These instructions are also documented at http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/.
- Click Start > Run (XP) or Start then click in the search field (Vista/Win7).
- Type IIS within the search/run field.
- Hit 'Enter' on your keyboard.
- Make sure you are targeting the "Default Web Site" in the left column.
- Double-click MIME Types in Features View.
- Click Add (right column).
- Set the file extension to .XAP.
- Set the MIME Type to application/x-silverlight-app
- Click OK.
- If the Web and Silverlight app is deployed locally, try adding a period ('.') after localhost, as in http://localhost.:
- Delete the entire cache for the test playback browser:
- In Interent Explorer, select: Tools > Internet Options > General Tab > Delete (Within the browsing history section)
- In Firefox, select: Tools > Clear Recent History > Select Everything in the 'Time Range to Clear' drop-down menu > Choose Clear Now
- In Safari, select: Settings (the gear in the upper-right of the Safari window) > Reset Safari > Check only Empty the Cache > Click Reset
- In Chrome, select: Tools menu > Options > Click the Under the Hood tab > Click Clear browsing data...
- Try increasing the (Settings.) Silverlight Connect Timeout if the Silverlight app has a longer load time.
- Try setting externalAccessfromCrossDomainCallers to script only your application's AppManifest.xaml file by doing the following in your html page and Silverlight manifest:
- Example for html page:
<param value="true" name="enableHtmlAccess" />
<div id="silverlightControlHost" />
<object height="300" width="300" type="application/x-silverlight-2" data="data:application/x-silverlight-2," >
<param value="http://a-remote-domain.com/ClientBin/SilverlightClient.xap" name="source" />
<param value="white" name="background" />
<param value="3.0.40723.0" name="minRuntimeVersion" />
<param value="true" name="enableHtmlAccess" />
<param value="visOnly=true" name="initParams" />
<a style="text-decoration: none;" href="http://go.microsoft.com/fwlink/?LinkID=149156">
<img style="border-style: none; width: 400px; height: 200px;" alt="Install Microsoft Silverlight" src="http://storage.timheuer.com/sl4wp-ph.png"/></a></object>
<iframe style="border: 0px none ; visibility: hidden; height: 0pt; width: 0pt;" /></div>
- Example for SL Manifest:
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ExternalCallersFromCrossDomain="ScriptableOnly">
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
(see this Microsoft forum thread for more information: http://forums.silverlight.net/forums/p/101955/340407.aspx)
- Try setting the "windowless" property for your Silverlight app to "true":
Example (similar to first example above):
<object id="xamlHost0" width="900" height="412" type="application/x-silverlight">
<param value="transparent" name="background"/>
<param value="true" name="windowless"/>
<!-- a bunch of other params go here -->
</object>
- Check the headers your server is sending for the Silverlight Page by:
- Install/Run Fiddler and load your Silverlight page.
- Click the response for the .xap file
- Click Inspectors > Headers.
There should be an entry titled: Content:application/x-silverlight-app
This must be in response in order for the Telerik Testing Framework or Test Studio to detect the Silverlight app.