Y
Y
Yuri2013-08-27 11:49:38
Microsoft Silverlight
Yuri, 2013-08-27 11:49:38

Silverlight + WCF: hosting settings?

Hello colleagues!
I'm looking for advice on configuring IIS for a Silverlight application using WCF.
If you run the project in Visual Studio for debugging, then everything works. As you know, VS runs IIS Express for this purpose. And, if you look, the Silverlight application uses the address locahost:39408, and WCF - locahost:39429:
4449721.jpg
Now you need to publish the site on the local network. I create a new site on the server in IIS, specify the path to the folder with the Silverlight application, bind it to a free port. The site is working, but Silverlight can't find where the web service is now located. Error message (from chrome console):

POST localhost :39429/Service2.svc
Uncaught Error: 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 SilverlightApplication1.ServiceReference1.NumberRowAtLinesCompletedEventArgs.get_Result
(
)


The obvious thought is that the wcf service also needs to be hosted and the silverlight needs to point the path to it. I do. In the Silverlight application, in the ServiceReferences.ClientConfig file, I change the service address from

<configuration>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="CustomBinding_Service2">
                    <binaryMessageEncoding />
                    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
                </binding>
            </customBinding>
        </ bindings>
        <client>
            <endpoint address=" localhost :39429/Service2.svc" binding="customBinding"
                bindingConfiguration="CustomBinding_Service2" contract="ServiceReference1.Service2"
                name="CustomBinding_Service2" />
        </client>
    </system.serviceModel>
</configuration>

on the
<configuration>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="CustomBinding_Service2">
                    <binaryMessageEncoding />
                    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
                </binding>
            </customBinding>
        </ bindings>
        <client>
<endpoint address=" myserver :8088/Service2.svc" binding="customBinding"
                bindingConfiguration="CustomBinding_Service2" contract="ServiceReference1.Service2"
                name="CustomBinding_Service2" />
        </client>
    </system.serviceModel>
</configuration>

(just in case, I give the entire text of the config).
But the error message does not change. Those. silverlight still keeps knocking on localhost:39429.

Where to fix this path to the service and is this the only thing?
There are a lot of manuals on the network on this topic, but they are quite contradictory. Just more confused from reading them.

Thanks in advance to everyone who wants to participate in the discussion.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2013-08-27
@bRUtality

All found!
On the WCF side, web.config has this entry:

< service name = "WcfService1.Service2" >
    < endpoint address = " myserver :8088/Service2.svc"  binding = "customBinding"  bindingConfiguration = "WcfService1.Service2.customBinding0"  contract = "WcfService1.Service2"  / >
    < endpoint address = "mex"  binding = "mexHttpBinding"  contract = "IMetadataExchange"  / >
< / service >

so, in it the full address is superfluous!
Substituted an empty string:
< service name = "WcfService1.Service2" >
    < endpoint address = ""  binding = "customBinding"  bindingConfiguration = "WcfService1.Service2.customBinding0"  contract = "WcfService1.Service2"  / >
    < endpoint address = "mex"  binding = "mexHttpBinding "  contract = "IMetadataExchange"  / >
< / service >

and earned.

N
noonesshadow, 2013-08-27
@noonesshadow

xap was not cached by chance?

Similar questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question