Silverlight应用程序不与服务器上的Web服务通信

时间:2012-05-25 10:38:40

标签: c# silverlight iis asynchronous

我已在笔记本电脑上本地开发了Silverlight应用程序。

一切正常但是当我将它部署到服务器时,Web服务运行正常,因为它与数据库进行通信并获得所需的结果。我的问题出在前端SL应用程序中,它提出了这个错误:

Debugging resource strings are unavailable

   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   at FrontEnd.WebService.UIDReturnCompletedEventArgs.get_Result()
   at FrontEnd.Views.Users.client_UIDReturnCompleted(Object sender, UIDReturnCompletedEventArgs e)
   at FrontEnd.WebService.Service1SoapClient.OnUIDReturnCompleted(Object state)
Caused by: [Async_ExceptionOccurred]
Arguments: 
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.1.10329.0&File=System.dll&Key=Async_ExceptionOccurred

所以我去了给出的链接,并说它是Async_ExceptionOccurred错误。 这是时间问题吗? UIDReturn是一个Web方法,它从数据库中返回一个用户ID,这是在Silverlight页面的页面加载时启动的,我想也许这个值没有及时回复,因此这就是它崩溃的原因这可以在本地和测试服务器上工作,所以它可能是一个IIS问题?

以下是调用Web服务的位置 -

 void OnLoadCompleted(object sender, RoutedEventArgs e)
    {
        string fullUserName = WebContext.Current.User.DisplayName;
        string userName = fullUserName.Substring(fullUserName.IndexOf('\\') + 1);


        WebService.Service1SoapClient client = new WebService.Service1SoapClient();

            client.UIDReturnCompleted += new EventHandler<UIDReturnCompletedEventArgs>(client_UIDReturnCompleted);
            client.UIDReturnAsync(userName);

    }

fullUserName来自当前登录的用户,可能此值尚未加载,因此会断开连接。

1 个答案:

答案 0 :(得分:0)

这似乎与我之前回答的这篇文章有关:Consume WCF library in Silverlight 4 application

相关问题