Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Silverlight2 beta2 with WCF service RSS

7 replies

Last post Jul 10, 2008 07:13 AM by hilander_jeff

(0)
  • hilander_jeff

    hilander_jeff

    Member

    1 Points

    5 Posts

    Silverlight2 beta2 with WCF service

    Jun 30, 2008 04:37 PM | LINK

    Hi,

    I have silverlight2 beta2 application connect to a WCF web service to get data. All the developments work fine on my laptop.

    When I move my web service and silverlight app to a Win2003 server, I got exception. I used external IP to check my web service, I saw the schema referenced my local machine's name like below

    <wsdl:types>

        <xsd:schema targetNamespace="http://tempuri.org/Imports">
    <xsd:import schemaLocation="http://arcgis01/wcfServiceOne/Service1.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
    <xsd:import schemaLocation="http://arcgis01/wcfServiceOne/Service1.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
    <xsd:import schemaLocation="http://arcgis01/wcfServiceOne/Service1.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/wcfServiceOne"/>
    </xsd:schema>
    </wsdl:types>

    And the service tag like this

    <wsdl:service name="Service1">

        <wsdl:port name="BasicHttpBinding_IService1" binding="tns:BasicHttpBinding_IService1">
    <soap:address location="http://arcgis01/wcfServiceOne/Service1.svc"/>
    </wsdl:port>
    </wsdl:service>

    Is the local machine name cause exception? How can I make the address as external IP instead of machine name.

    Thanks for any help.

     


     

  • Allen Chen – MSFT

    Allen Chen –...

    Star

    14215 Points

    1854 Posts

    Microsoft

    Re: Silverlight2 beta2 with WCF service

    Jul 02, 2008 03:21 AM | LINK

    Hi:

      You need to change the address in ServiceReferences.ClientConfig:

    <client>
                <endpoint address="Change uri here" binding="basicHttpBinding"

      If you set the EndpointAddress in your code you have to change your code.

    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.
  • hilander_jeff

    hilander_jeff

    Member

    1 Points

    5 Posts

    Re: Re: Silverlight2 beta2 with WCF service

    Jul 03, 2008 05:31 PM | LINK

     Thanks for help. I did change the address in the <endpoint> tag to the external address I want. It still give me exception.

    Actually, when I created the service reference, VS will create the endpoint for you.  

  • sladapter

    sladapter

    All-Star

    43609 Points

    7910 Posts

    Re: Re: Silverlight2 beta2 with WCF service

    Jul 03, 2008 05:51 PM | LINK

    You might have cross-domain issue here. Do you have clientaccesspolicy file in your Server's inetpub\wwwroot folder?

    Even when your page and your Service are running from the same site, depending the url you used when you access your page could still cause the cross-domain issue.

    When you on your server machine, you could type http://localhost/YourSilverlightSite/YourPage.html;

    the domain is http://localhost; 

    but your service url is http://arcgis01/YourSilverlightSite/YourService.svc;

    the domain name here is http://arcgis01

    This is considered cross-domain call. So either you put a clientaccesspolicy file in place, or you could follow this thread to see the suggestions I put up there if your Service and your Page are running from the same WebSite.

    http://silverlight.net/forums/t/19215.aspx

     

     

    Sally Xu
    Software Engineer
    Aprimo, Inc

    Please remember to mark the replies as answers if they answered your question
  • hilander_jeff

    hilander_jeff

    Member

    1 Points

    5 Posts

    Re: Re: Re: Silverlight2 beta2 with WCF service

    Jul 03, 2008 06:07 PM | LINK

     Hi,

    This is my external box for myservice.

    http://75.21.35.39/wcfServiceOne/Service1.svc.

    I used svcutil.exe to generate Service.cs and Output.config files.

    svcutil.exe http://75.21.35.39/wcfServiceOne/Service1.svc

    I found the endpoint in the config file is like the following.

    <client>
                <endpoint address="http://arcgis01/wcfServiceOne/Service1.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                    contract="IService1" name="BasicHttpBinding_IService1" />
            </client>

    So, the service will use the machine name for the url automatically. Is there anyway to change that?

    Thanks.
     

  • sladapter

    sladapter

    All-Star

    43609 Points

    7910 Posts

    Re: Re: Re: Silverlight2 beta2 with WCF service

    Jul 03, 2008 06:17 PM | LINK

    If it's external service, then why you put address="http://arcgis01/wcfServiceOne/Service1.svc" instead of adress="http://75.21.35.39/wcfServiceOne/Service1.svc" ?

    Is 75.21.35.39 the IP for "arcgis01"?

    Try to set your endpoint address="http://75.21.35.39/wcfServiceOne/Service1.svc" and see what do you get.

    If you already deployed your web site and do not want to rebuild. You can change the ServiceReferences.ClientConfig file on the server machine by using WinRar tool (http://www.download.com/WinRAR/3000-2250_4-10007677.html). Use this tool to extact ServiceReferences.ClientConfig file out of .Xap file, modify it then re-zip it back.

     

    Sally Xu
    Software Engineer
    Aprimo, Inc

    Please remember to mark the replies as answers if they answered your question
  • hilander_jeff

    hilander_jeff

    Member

    1 Points

    5 Posts

    Re: Re: Re: Re: Silverlight2 beta2 with WCF service

    Jul 03, 2008 06:30 PM | LINK

     Hi,

    The IP 75.21.35.39 is not for arcgis01. The gateway just route the traffic from that IP to arcgis01 machine. Will this be a problem?

     I will try your suggestion to see what I get.

     Thanks.
     

  • hilander_jeff

    hilander_jeff

    Member

    1 Points

    5 Posts

    Re: Re: Re: Silverlight2 beta2 with WCF service

    Jul 10, 2008 07:13 AM | LINK

     Hi,

    I manually change the endpoint address="http://75.21.35.39/wcfServiceOne/Service1.svc" in the ServiceReference.ClientConfig file in the development environment. I recompile the client program and copy .xap file to my server. It works!!!

    Give my thanks to sladapter.