Bug reports Found a bug? Post it here please.
Version 4.x > Bug reports > Silverlight View modes: 
User avatar
Member
Member
AP-Kentico - 8/5/2009 12:15:30 PM
   
Silverlight
Hi,

I am getting following error while accessing a silverlight page.

I have done following to add the silverlight app.
Added interface and class in app_code
added SimpleWCF.svc
add silverlight app in the solution which on build added a xap file in the clientbin folder.
After adding the webpart, I added application path as :~/ClientBin/SilverlightApplication1.xap
What should I enter for endpoint address and parameters or it doesn't make any difference.

Thanks,
Anil

Error:
-----------------------------------------------
Message: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at SilverlightApplication1.ServiceReference1.SayHelloToMeCompletedEventArgs.get_Result()
at SilverlightApplication1.MainPage.proxy_SayHelloToMeCompleted(Object sender, SayHelloToMeCompletedEventArgs e)
at SilverlightApplication1.ServiceReference1.SimpleWCFClient.OnSayHelloToMeCompleted(Object state)
Line: 1
Char: 1
Code: 0
URI: http://localhost/KenticoCMSTest/Silverlight.aspx
-----------------------------------------------

User avatar
Member
Member
AP-Kentico - 8/6/2009 2:11:42 PM
   
RE:Silverlight
Some progress, but the problem remains.

I can access the silverlight page by this url http://localhost:1400/KenticoCMSTest/Silverlight.aspx and the silverlight can talk to WCF.
I did not pass anything in the endpoint in the silverlight api but created the relative uri as follows:

BasicHttpBinding basic = new BasicHttpBinding(BasicHttpSecurityMode.None);
Uri uri = new Uri(App.Current.Host.Source, "../Service/DataService.svc");
EndpointAddress addr = new EndpointAddress(uri);

Has anyone used the endpoint url as address passed to the webpart and used it in silverlight? Are you able to access the site without the port no?

Please help me out.
Thanks,
AP

User avatar
Member
Member
petr.vozak-kentico - 8/27/2009 1:24:13 AM
   
RE:Silverlight
Hi, description of the EndpointAddress parametr of the Silverlight web part says:
"If specified, its value is added as parameter with key 'endpoint' to the application parameters collection. You need to handle this parameter in your Silverlight application to take it effect." It means you don't have to use it to get your web service working properly. I recommend you to read my blog post about Silverlight communication methods, see http://devnet.kentico.com/Blogs/Petr-Vozak/February-2009/Data-communication-in-Silverlight-2-0.aspx . Anyway, example of using endpoint address parametr from Silverlight web part can be seen in our code examples which are installed on your computer together with the Kentico CMS, you can find them in <kentico installation folder>/CodeSamples/Silverlight/ProductList. This Silverlight application is a simple product list, see more details here http://devnet.kentico.com/Blogs/Petr-Vozak/November-2008/Kentico-CMS-supports-Silverlight-2-0.aspx . I hope it helps you.

User avatar
Member
Member
AP-Kentico - 8/27/2009 2:36:58 PM
   
RE:Silverlight
I have gone through the urls provided but I am still having some issues:

I can access the url if I use the port no. like http://localhost:1469/Kentico40/Company/Silverlight.aspx
But when I try to access the site normally without the port no, I get following error.

An error occurred while trying to make a request to URI 'http://localhost:1469/Kentico40/CSS/TestService.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.

Here is my silverlight code:

private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
TestServiceReference.TestServiceClient(binding, endpoint);
TestServiceReference.TestServiceClient client = new TestServiceReference.TestServiceClient();
client.DoWorkCompleted +=new EventHandler<SilverlightApplication1.TestServiceReference.DoWorkCompletedEventArgs>(client_DoWorkCompleted);
client.DoWorkAsync(input.Text);
}

void client_DoWorkCompleted(object sender, SilverlightApplication1.TestServiceReference.DoWorkCompletedEventArgs e)
{
if (e.Error == null)
output.Text = "success " + e.Result;
else
output.Text = e.Error.Message;
}

I am using basicHttpBinding.
I also placed clientaccesspolicy.xml in the wwwroot folder, but still not working.

What am I missing?

Thanks for your help.
AP

User avatar
Member
Member
petr.vozak-kentico - 8/28/2009 1:51:09 AM
   
RE:Silverlight
Hi, it really seems to be a problem with your policy file or something bad about the service reference. See following threads, they may help you to solve your problem:
1) http://silverlight.net/forums/t/48292.aspx
2) http://social.msdn.microsoft.com/Forums/en-US/silverlightdeveloper/thread/b7eab002-d162-452e-9b3f-22fe3d3031b9
3) http://silverlight.net/forums/46.aspx