0
votes

I have a normal .asmx web service which loads fine in the browser. When I load the web page with the Silverlight app in it, the data doesn't load and I get a javascript error which states;

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) Timestamp: Wed, 1 Sep 2010 16:43:32 UTC

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 Operations.Dashboard.DashboardMetrics.GetP200MA_CountCompletedEventArgs.get_Result() at Operations.Dashboard.MainPage.client_GetP200MA_CountCompleted(Object sender, GetP200MA_CountCompletedEventArgs e)
at .Operations.Dashboard.DashboardMetrics.MetricsSoapClient.OnGetP200MA_CountCompleted(Object state) Line: 1 Char: 1 Code: 0 URI: http://ukhqdevmp-3790:8080/ChartTestPage.aspx

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 Operations.Dashboard.DashboardMetrics.GetP200C_CountCompletedEventArgs.get_Result() at Operations.Dashboard.MainPage.client_GetP200C_CountCompleted(Object sender, GetP200C_CountCompletedEventArgs e)
at Operations.Dashboard.DashboardMetrics.MetricsSoapClient.OnGetP200C_CountCompleted(Object state) Line: 1 Char: 1 Code: 0 URI: http://ukhqdevmp-3790:8080/ChartTestPage.aspx

It all runs fine within VS but when accessing it from another PC via IIS, it doesn't work.

MetricsSoapClient client = new MetricsSoapClient();
client.GetP200C_CountCompleted += new EventHandler<DashboardMetrics.GetP200C_CountCompletedEventArgs>(client_GetP200C_CountCompleted);
client.GetP200C_CountAsync(yearStart, yearEnd);
client.GetP200MA_CountCompleted += new EventHandler<DashboardMetrics.GetP200MA_CountCompletedEventArgs>(client_GetP200MA_CountCompleted);
client.GetP200MA_CountAsync(yearStart, yearEnd);

public void client_GetP200C_CountCompleted(object sender, DashboardMetrics.GetP200C_CountCompletedEventArgs e)
{ ... 

UPDATE: Using Fiddler, I can see that it's a security issue, I'm guessing a double-hop one.

Login failed for user 'DOMAIN\UKHQDEVMP-3790$'.

1
can you post the code you use to initialize the web service call? - Kelsey
Sounds like you need to post the contents of the InnerException as well if you want anything useful. - Justin Niessner
@Kelsey - I created a new Silverlight 4 project (and associated web app to host it). In the web app I created a web service to publish data from a database using Linq. I then consume this in my MainPage.xaml.cs using the code below. - sparkymark75
MetricsSoapClient client = new MetricsSoapClient(); client.GetP200C_CountCompleted += new EventHandler<DashboardMetrics.GetP200C_CountCompletedEventArgs>(client_GetP200C_CountCompleted); client.GetP200C_CountAsync(yearStart, yearEnd); client.GetP200MA_CountCompleted += new EventHandler<DashboardMetrics.GetP200MA_CountCompletedEventArgs>(client_GetP200MA_CountCompleted); client.GetP200MA_CountAsync(yearStart, yearEnd); public void client_GetP200C_CountCompleted(object sender, DashboardMetrics.GetP200C_CountCompletedEventArgs e) { ... } - sparkymark75
you should edit your original question when posting more information. I have moved your code into your question. Notice the difference from your code and the code I posted below. Make sure your Uri is correct. Try instantiating your web service like I have and include all the details. I think your webservice is pointing to a local or relative address so moving it causes things to break. - Kelsey

1 Answers

0
votes

First off, you should verify that when you move it to another PC that your webservice address is correct and you are not trying to connect to localhost or something relative to your Visual Studio enviroment.

I remember having this issue but very vaguely and I can't remember what my solution was so I went back and looked at some code for a previous project and how the web service was setup. This is a long shot but maybe my code will help point you in the right direction if the web service setup is incorrect. Check the following line I had and see if it helps with anything (this was done with Silverlight 3):

Uri uri = new Uri(Application.Current.Host.Source,
    "../Services/YourWebService.asmx");

// notice this line is commented out and a * is used for biniding instead
//System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding(); // "*"

YourWebService.YourWebServiceSoapClient = 
    new YourWebService.YourWebServiceSoapClient("*",
            new System.ServiceModel.EndpointAddress(uri));