开发者

Error when communicate with WCF-Service via https in Silverlight 4

in my Silverlight 4 application, I want to consume a WCF-Service via https and User Authentication. I have created and published a test service, which is running at https://pcai043.informatik.uni-leipzig.de/ServiceConfiguratorDataSource/Service.svc

Then I added the service reference to my silverlight project in VS2010 and VS created the appropriate classes. Then I tried to call the Service:

private void ButtonTest_Click(object sender, System.Windows.RoutedEventArgs e)
{
  WCFDataPr开发者_JAVA百科ovider.ServiceClient proxy = new WCFDataProvider.ServiceClient();
  proxy.GetDataCompleted += new EventHandler<WCFDataProvider.GetDataCompletedEventArgs>(proxy_GetDataCompleted);
  proxy.ClientCredentials.UserName.UserName = "theName";
  proxy.ClientCredentials.UserName.Password = "thePwd";
  proxy.GetDataAsync(10);
}

void proxy_GetDataCompleted(object sender, WCFDataProvider.GetDataCompletedEventArgs e)
{
  MessageBox.Show(e.Result, "WCF Service Call", MessageBoxButton.OK);
}

When I call the service, I get the following exception: "Unhandled Error in Silverlight Application"

Laufzeitfehler in Microsoft JScript: Unhandled Error in Silverlight Application Während des Vorgangs ist eine Ausnahme aufgetreten, sodass das Ergebnis ungültig ist. Weitere Ausnahmedetails finden Sie in InnerException.

bei System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() bei ServiceConfiguratorWebPrototyp.WCFDataProvider.GetDataCompletedEventArgs.get_Result() bei ServiceConfiguratorWebPrototyp.MainPage.proxy_GetDataCompleted(Object sender, GetDataCompletedEventArgs e) bei ServiceConfiguratorWebPrototyp.WCFDataProvider.ServiceClient.OnGetDataCompleted(Object state)

This error is thrown by the aspx-page which contains my silverlight app. VS opens a new tab labeled "eval code [dynamical]" which contains nothing but a line that throws the above error.

Any idea, what might cause this error and/or how to find out more details about it? I set breakpoints at proxy_GetDataCompleted, private void OnGetDataCompleted(object state) and string ServiceConfiguratorWebPrototyp.WCFDataProvider.IService.EndGetData(System.IAsyncResult result) in the Reference.cs file, but it doesn't stop at any of those lines.

Thanks in advance,

Frank


The Silverlight-Debug Option has to be enabled in the Web-Tab of the Configuration of the Website that contains the Silverlight-Application

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜