Skip to main content

Microsoft Silverlight

Unanswered Question Can't get beyond HTTP ErrorRSS Feed

(0)

ihdalton68
ihdalton68

Member

Member

2 points

2 Posts

Can't get beyond HTTP Error

I’m brand new with Silverlight, so all I’m trying to do is a very simplistic example with hooking up a WCF service and hook it up to the Silverlight control that is hosted within an aspx page.

 

I was able to take the existing WCF and have it feed a WinForms example without any errors, but when I then hook it up to the Silverlight example it blows up with the following error.

 An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code Additional information: [UnexpectedHttpResponseCode]Arguments:Not FoundDebugging 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=2.0.30226.2&File=System.ServiceModel.dll&Key=UnexpectedHttpResponseCode 

I have gone through all the forums and googled other answers, but so far nothing has worked.

 

My Page.xaml:

<UserControl xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="CustomerClient2.Page"    xmlns="http://schemas.microsoft.com/client/2007"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Width="400" Height="300">    <Grid x:Name="LayoutRoot" Background="White"><my:DataGrid x:Name="dg" AutoGenerateColumns="True"            GridlinesVisibility="Horizontal" HeadersVisibility="Column"            RowBackground="Cornsilk" AlternatingRowBackground="LemonChiffon"            ColumnWidth="85" RowHeight="30"            IsReadOnly="True" CanUserResizeColumns="False">    </my:DataGrid>    <Button Content="Send to WCF web service" Width="200" Height="50" x:Name="btnSend" Click="btnSend_Click" />    </Grid></UserControl> 

My Page.xaml.vb:

Partial Public Class Page    Inherits UserControl     Private _Proxy As New ServiceReference.Service1Client    Private _test As ServiceReference.CompositeType     Public Sub New()        InitializeComponent()         AddHandler _Proxy.GetDataUsingDataContractCompleted, AddressOf Proxy_Completed     End Sub     Private Sub Proxy_Completed(ByVal sender As Object, ByVal e As ServiceReference.GetDataUsingDataContractCompletedEventArgs)         If e.Error.ToString <> "" Then            dg.ItemsSource = e.Error.StackTrace        Else            dg.ItemsSource = e.Result        End If    End Sub     Private Sub btnSend_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnSend.Click        _Proxy.GetDataUsingDataContractAsync()    End SubEnd Class  

My ClientConfig:

<configuration>    <system.serviceModel>        <bindings>            <basicHttpBinding>                <binding name="BasicHttpBinding_IService1" maxBufferSize="65536"                    maxReceivedMessageSize="65536">                    <security mode="None" />                </binding>            </basicHttpBinding>        </bindings>        <client>            <endpoint address="http://localhost:8731/Design_Time_Addresses/CustomerService/Service1/"                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"                contract="ServiceReference.IService1" name="BasicHttpBinding_IService1" />        </client>    </system.serviceModel></configuration>  

The error happens (bolded section) with the Reference.vb file in the following function:

 Public Function EndGetDataUsingDataContract(ByVal result As System.IAsyncResult) As ServiceReference.CompositeType Implements ServiceReference.IService1.EndGetDataUsingDataContract                Dim _args((0) - 1) As Object                Dim _result As ServiceReference.CompositeType = CType(MyBase.EndInvoke("GetDataUsingDataContract", _args, result),ServiceReference.CompositeType)                Return _result            End Function

I have seen many answers saying it’s a cross-domain issue, but if I am running everything within the same machine/solution I don’t see how it can be that, but anyways I created a clientaccesspolicy.xml file and put it in a few places (I couldn’t figure out exactly where it belonged , so I put it in (inetpub/wwwroot, in the root of the web project directory). Here is my url for the test asp.net web project in case it helps.

http://localhost:3746/CustomerClient2_Web/CustomerClient2TestPage.aspx 

If anyone can give me a glimpse on what is going on with this implementation would be greatly appreciated.

 

Sergey.Lutay
Sergey.L...

Contributor

Contributor

7256 points

1,354 Posts

Re: Can't get beyond HTTP Error

You should debug your WCF service with Silverlight application.

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)

Blog

Twitter

Sincerely,
Sergey Lutay

ihdalton68
ihdalton68

Member

Member

2 points

2 Posts

Re: Can't get beyond HTTP Error

I have debugged the WCF w/ Silverlight and got that generic error (line in bold is the spot) in the following function within the reference.vb file

Public Function EndGetDataUsingDataContract(ByVal result As System.IAsyncResult) As ServiceReference.CompositeType Implements ServiceReference.IService1.EndGetDataUsingDataContract                Dim _args((0) - 1) As Object               

 Dim _result As ServiceReference.CompositeType = CType(MyBase.EndInvoke("GetDataUsingDataContract", _args, result),ServiceReference.CompositeType)               

Return _result           

End Function

Allen Chen – MSFT
Allen Ch...

Star

Star

13873 points

1,803 Posts

Re: Can't get beyond HTTP Error

Hi:

  Try to put cross domain file under C:\Inetpub\wwwroot to see if it works

http://msdn2.microsoft.com/en-us/library/cc197955(VS.95).aspx

  And please refer to our tutorial:

http://silverlight.net/Quickstarts/Remote/323aac2f-14cc-4dd8-bb40-fa2cb3c2e522.aspx

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

balukr54
balukr54

Member

Member

124 points

143 Posts

Re: Can't get beyond HTTP Error

HI All,

I am using a silverlight 2.0 application. Application shows the following error in certain machines, when try to access a web service.

 This is the error I am getting

. ========================================================

Additional information: [UnexpectedHttpResponseCode] Arguments:Not Found 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=2.0.30226.2&File=System.ServiceModel.dll&Key=UnexpectedHttpResponseCode ==============================================================================================

 This problem occurred after we deployed our application to the server provided by our client. This issue is not in our localhost and in our servers. This error is coming only in one or two systems and only in IE. FireFox it is working fine. I tried with NikhilK’s Web Development Helper tool and the status of web service call shown is 200 and the response content contains the output XML also. we deployed the service in same application directory (www.mywebsite.com/service.asmx) and it is accessible from the machine which is giving problem. Also we can access clientaccesspolicy.xml & crossdomain.xml from the machine which is giving problem. Anyone Got any idea??

 Thanks in advance for any help...

Balu

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities