I'm new in Silverlight and WCF. I have Silverlight App and WCF Service, when I want run my application I have error: "An error occurred while trying to make a request to URI 'http://127.0.0.1:8080/evals/basic'. 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."
My code: Silverlight:
EvalServiceClient channel = new EvalServiceClient("BasicHttpBinding_IEvalService"); Eval eval = new Eval(); channel.GetEvalsCompleted += (o, r) => { if (!r.Cancelled && r.Error == null) { grOdebrane.ItemsSource = r.Result; } else { MessageBox.Show("No data in source!"); } }; channel.GetEvalsAsync();
In Service (I have interface with OperationContarct):
public class EvalService:IEvalService { List<Eval> list_email_log = new List<Eval>(); public void SubmitEval(Eval eval) { list_email_log.Add(eval); }
And error indicates:
public System.Collections.Generic.List<Emails2.EmailWCFServiceReference.Eval> EndGetEvals(System.IAsyncResult result) { object[] _args = new object[0]; System.Collections.Generic.List<Emails2.EmailWCFServiceReference.Eval> _result = ((System.Collections.Generic.List<Emails2.EmailWCFServiceReference.Eval>)(base.EndInvoke("GetEvals", _args, result))); return _result; }
I use only localhost, so do I need to create croosdomain.xml and clientaccesspolicy.xml? Anyone help me?
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog