2010-11-02 126 views
0

进行通信时发生错误,我想通过https和用户身份验证使用WCF服务。我创建并发布了一个测试服务,它运行在https://pcai043.informatik.uni-leipzig.de/ServiceConfiguratorDataSource/Service.svc在Silverlight 4应用程序中通过https与Silverlight 4

然后我在VS2010中添加了服务引用到我的silverlight项目,VS创建了相应的类。然后我试着拨打服务:

private void ButtonTest_Click(object sender, System.Windows.RoutedEventArgs e) 
{ 
    WCFDataProvider.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); 
} 

当我调用服务,我得到以下异常:“未处理的错误在Silverlight应用程序”

Laufzeitfehler Microsoft JScript中:未处理的错误在Silverlight应用程序WährendDES Vorgangs ist eine Ausnahme aufgetreten,sodass das Ergebnisungültigist。 Weitere Ausnahmedetails finden Sie in InnerException。
贝System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 贝ServiceConfiguratorWebPrototyp.WCFDataProvider.GetDataCompletedEventArgs.get_Result() 贝ServiceConfiguratorWebPrototyp.MainPage.proxy_GetDataCompleted(对象发件人,GetDataCompletedEventArgs E) 贝ServiceConfiguratorWebPrototyp.WCFDataProvider.ServiceClient.OnGetDataCompleted(对象状态)

这个错误是由包含我的silverlight应用程序的aspx页面抛出的。 VS打开一个标签为“eval code [dynamical]”的新选项卡,其中只包含引发上述错误的行。

任何想法,什么可能会导致此错误和/或如何找到更多关于它的细节?我在Reference.cs文件中设置了proxy_GetDataCompleted,private void OnGetDataCompleted(对象状态)和字符串ServiceConfiguratorWebPrototyp.WCFDataProvider.IService.EndGetData(System.IAsyncResult结果)中的断点,但它不会在任何这些行中停止。

由于提前,
弗兰克

+0

你的异常翻译成英文说:在此过程中发生异常,所以结果无效。有关更多详细信息,请参阅InnerException中的异常。内部例外说什么? – 2010-11-02 17:02:51

+0

这就是问题所在。我没有(找到)任何方式来检查异常,因为只有在Silverlight应用程序将消息传递给包含应用程序的aspx或html网站时才显示消息。这只是一个文本字符串,显示在所提到的“eval code [dynamical]”页面中,VS在错误发生时创建 – Aaginor 2010-11-03 08:11:03

+0

好吧,找到它。您需要在Web-Project的Property-Page的Web选项卡中启用Silverlight-Debug选项(为什么地球上不会自动检查?什么样的开发人员不希望调试程序停止发生错误?)。现在我得到一个很好的描述“安全错误”。简短但痛苦。现在我会进一步了解这一点,我知道该看哪里。 – Aaginor 2010-11-03 09:19:00

回答

0

的Silverlight的调试选项必须在网站的配置中包含Silverlight的应用程序的Web-Tab键启用