Coded UI Test builder fails to recognize controls when XAP is hosted at different domain - silverlight

The Coded UI Test Builder fails to recognize Silverlight controls when the application (XAP) source is a different domain
I placed XAP at two different locations
http:\Domain1\MyApp\MyApp.XAP
http:\Domain2\MyApp\MyApp.XAP
My WebPage is at http:\Domain1\HomePage.html
If the Silverlight object's source is set to 1st one (same domain) it works fine and CUIT builder recognizes, records and playbacks properly. But, when I set the source to 2nd one (i.e. different domain), the CUIT builder fails to recognize Silverlight app.
The application itself work fine when hosted at Domain1 or Domain2. The recording is also successful when web page at DomainX refers to app at same DomainX. It fails to record when web page at DomainX refers to the same app at DomainY. What do I need to make it work?
Thanks
PS: Please note that the Silverlight application itself works fine no matter from which domain I am using - I have appropriate crossdomain policy file available and enableHtmlAccess set to true.
I have also verified presence of automation helper dll in XAP at both places (infact same XAP has been placed

I had logged this bug on MSDN connect - Coded UI Test builder fails to recognize Silverlight controls in cross domain XAP
This has been marked as "Won't Fix":
"We have investigated this scenario and determined that cross-domain XAPs cannot be supported by Coded UI Test. We use CreateFromXAML apis to enable the UI Testing component for Silverlight and
this API is failing for cross domain XAPs. Unfortunately, we have not been able to identify a workaround either. Closing the bug as Won't fix"

Related

Does Silverlight support Outlook Addin(Javascript API)?

We are trying to integrate Silverlight components in Outlook task panel which is developed by Outlook Javascript API. However when mailapp(task panel) loaded, it appears error and it prompts the Silverlight addin failed to run and please check security settings in “Internet Options”. I also tried adding website URL into IE trusted sites list, but this error remains. But I also notice that it works fine in IE browsers.
I know the mailapp (task panel) initials a web browser (IE kernel) in embedded mode. But I really want to confirm whether Silverlight is supported or NOT in MailApp? If it's supported, how should I do?
Anyone gives me the right answer will save my life. Thanks in advance.
It prompts security settings conflicted in MailApp
But it works fine in a separate IE browser

"Calls to the web service will fail..." Once Again

Last year someone reported encountering this problem ("The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the silverlight project is hosted in and launched from the same web project that contains the web services.") and accepted the answer to "set the web project which hosts the Silverlight application to be your startup project."
I'm seeing the same message, but think the solution might have to be different. I am building in VS 2010 a Silverlight application to access the Google Weather API, with VB as the code-behind. The API will return a XML file with data for the specified city (ex., "http://www.google.com/ig/api?weather=london,england"). The Solution Explorer only shows my VB/Silverlight project ("GetWeather"), and the Project Properties dialog box shows the Startup Object as "GetWeather.App" -- the only choice. I'm trying to use a WebClient object to make the call and an XDocument object to parse the return. But I repeatedly get the above error message, with no other result. What am I doing wrong?
Thank you in advance!
I would add a simple Web project and configure it to host the Silverlight app. You'll need to host the app somewhere anyways, so why not create a stub ASP.NET application in your solution? The easiest way is to create a new Silverlight app solution selecting an ASP.NET web project as the host, and then copying your existing code to that solution. Then you should set the web project as the startup one. This should make debugging a lot easier.
Besides, do remember to configure the client access policy to enable cross-domain calls. Check out this article

Start WPF application from link in browser?

We have a requirement to start a WPF application with specific parameters from a link in a browser.
We are wondering if this is possible?
As an alternative could we embed the web application in a WPF browser control, and read the values out of the html web page?
Several possibilities :
if you control the browser (i.e. if you are in an intranet scenario, and have the opportunity to deploy applications), you can :
create an activex or plugin that runs the application
register a new uri scheme to interpret the url of kind "yourapplication://yourarguments"
(complex): deploy a listening app ran under the user session, and from the webapplication, ask this listening app to run the target application
reduce the security of the browser (not recommended)
if you don't control the browser:
create a clickonce application... this involves a setup, but which does not require admin privilege
Moving to Silverlight also might be an option, depending on your needs. SilverLigth V5 (still in beta) notably adds the ability for an admin to control the rights of the application via a GPO
Note: My feelings is the later option (Silverlight) is far more preferable because it's a lot more cleaner and less security hole factor. However, it can only be done if your requirements fits into the SL features
It is not possible to call client app from a browser, previously it was possible from activex controls but for that you need to have a signed library, in wpf you can make browser based application but you cant embed your web app in it.
So partially you are correct if you used wpf app you will be able to launch application on client side but with browser it seems difficult until unless you make activex control
but still i am not 100% sure that with activex control you will be able to launch the app or not

Accessing SP 2010 Object Model from Silverlight 4 Application

I have a Silverlight 4 Beta application where I'd like to use the SharePoint object model to upload a document to a SharePoint site - should be simple enough, except an exception is thrown at:
using (SPSite siteCollection = new SPSite(siteCollectionUrl))
The Web application at
http://intranet.fabrikam.com could not
be found. Verify that you have typed
the URL correctly. If the URL should
be serving existing content, the
system administrator may need to add a
new request URL mapping to the
intended application.
This particular exception is actually really well documented out there, it's obviously masking a real underlying issue. Here are some of the things I've read about and tried without success:
DNS / Host Header:
This exception occurs when the particular URL isn't in the IIS metabase because it's being handled by DNS. My web application has an AAM set up and a host header on the web site in IIS. I also tried running the code without using the FQDN of the site, e.g. http: //servername:4860.
Permissions:
The identity of the the Silverlight application pool has db_owner permissions to my content database, and is also a site collection administrator. I can't have both web sites use the same application pool because the Silverlight application needs to run in a .NET app pool.
x86 vs x64:
My Silverlight application has to be compiled for x86 - I'm using some controls that only work in x86. The installed SharePoint version is x64. I've read about people seeing this exception when trying to use the SharePoint object model to hit a x64 SharePoint installation from a x86 app.
Adding then removing permissions for the account: This begins to border on some voodoo magic, but I read about people magically resolving this issue after removing the permissions they set trying to troubleshoot this problem initially. No luck here.
Would appreciate any suggestions, thank you!
Silverlight runs on the client/browser, not on the server - so the server-side SharePoint object model will not be available to you.
However, there is an object model for SharePoint 2010/Silverlight apps - see this MSDN article for details.
To fix the particular error you mentioned, use "List", instead of "SPList". The Silverlight SharePoint object model is a little different from the basic non-Silverlight SharePoint object model.

cross-domain problem

I am using a silverlight with wcf and when I use the .web project then it runs but when use the silver light project to run the following exception throws:
An error occurred while trying to make a request to URI 'http://localhost:9000/Services/BLWCFSvrc.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
I want to use the silverlight project to debug my code
Thanks in advance
In order to access network resources from Silverlight, the domain hosting the resource must provide a client access policy file; this is designed this way for security reasons. See here for details: http://msdn.microsoft.com/en-us/library/cc645032%28VS.95%29.aspx
I think your problem is different that just having the clientaccesspolicy.xml, the fact that it runs under the web project, means that you are delivering policies, if you have those added as seperate files under the web project then they wont be deployed when you run the SL3 app seperately, but im sure you figured this out and you're delivering the policies via WCF using webHttp binding (RESTful style), if not, you should.
I think the problem is that when you run the webproject, it builds to your local IIS and executes from there, IIS will allow the SL3 app to communicate with ports/addresses different from the ones that the site is hosted on
when you run SL3 app natively, VS2008 auto generates a test html site for it to be hosted in with some default settings, and uses VS2008 built-in hosting service, which does not allow communication to an address/port different from that of the hosting address. (even though Silverlight is a client side library, VS2008 can do this)
so if you want to run the Silverlight application natively, meaning actually executing the XAP, you can deploy it to IIS, and configure IIS to deliver XAP files, or just install it and run it out of browser and let it update from IIS the deployed version
Just copy a clientaccesspolicy.xml file (for an example take a look at this post; you can even use this sample) into the root of your webserver (eg: c:\inetpub\wwwroot\).
This should help.

Resources