Correct WCF implemetation?
-
Thursday, July 30, 2009 5:57 AM
Hey folks!
I have developed a Silverlight Application wich is used to create mp3 playlists. The SL application uses WCF services from an existing web site. I added the services by "Add service reference..." in the SL project. Is this the propper way to add services???
A service call looks like:
1 CommonDataService.CommonDataServiceClient service = new PlanetDigital.Silverlight.BoxSteering.CommonDataService.CommonDataServiceClient();
2 service.GetUserIntendedOrganisationCompleted += new EventHandler(service_GetUserIntendedOrganisationCompleted);
3 service.GetUserIntendedOrganisationAsync();
Here is the ServiceReference.ClientConfig:
1 <configuration> 2 <system.serviceModel> 3 <bindings> 4 <basicHttpBinding> 5 <binding name="BasicHttpBinding_IExecutionPlanService" maxBufferSize="2147483647" 6 maxReceivedMessageSize="2147483647"> 7 <security mode="None" /> 8 </binding> 9 <binding name="BasicHttpBinding_IMp3PlayListService" maxBufferSize="2147483647" 10 maxReceivedMessageSize="2147483647"> 11 <security mode="None" /> 12 </binding> 13 <binding name="BasicHttpBinding_IMp3TitleService" maxBufferSize="2147483647" 14 maxReceivedMessageSize="2147483647"> 15 <security mode="None" /> 16 </binding> 17 <binding name="BasicHttpBinding_ICommonDataService" maxBufferSize="2147483647" 18 maxReceivedMessageSize="2147483647"> 19 <security mode="None" /> 20 </binding> 21 </basicHttpBinding> 22 </bindings> 23 <client> 24 <endpoint address="http://10.158.64.250/PlanetDigital/Service/WCFServices/BoxSteering/ExecutionPlanService.svc" 25 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IExecutionPlanService" 26 contract="ExecutionPlanService.IExecutionPlanService" name="BasicHttpBinding_IExecutionPlanService" /> 27 <endpoint address="http://10.158.64.250/PlanetDigital/Service/WCFServices/BoxSteering/Mp3PlayListService.svc" 28 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMp3PlayListService" 29 contract="Mp3PlayListService.IMp3PlayListService" name="BasicHttpBinding_IMp3PlayListService" /> 30 <endpoint address="http://10.158.64.250/PlanetDigital/Service/WCFServices/BoxSteering/Mp3TitleService.svc" 31 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMp3TitleService" 32 contract="Mp3TitleService.IMp3TitleService" name="BasicHttpBinding_IMp3TitleService" /> 33 <endpoint address="http://10.158.64.250/PlanetDigital/Service/WCFServices/Common/CommonDataService.svc" 34 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICommonDataService" 35 contract="CommonDataService.ICommonDataService" name="BasicHttpBinding_ICommonDataService" /> 36 </client> 37 </system.serviceModel> 38 </configuration>
As you can see, I entered the servers ip address. If so i can enter the the application and receive all data but not when I am on the server.
If I enter localhost, I'm able to call the app from my machine but the services don't get called (no data are transmitted), I can access it directly on the server and the data is transmitted.
What do i have to do, to reach the services from anywhere i call the sl app.
It would be awesome if anybody can help me out of this.
Sorry for my bad english ;)....
Thx in adv! James
All Replies
-
Thursday, July 30, 2009 6:32 AM
Hi,
Are you able to browse your WCF Service thorugh localhost ? Can you post your web config's system.serviceModel tag?
-
Thursday, July 30, 2009 6:57 AM
Yes i can browse the service with:
- http://localhost/PlanetDigital/Service/WCFServices/BoxSteering/Mp3TitleService.svc
- http://machineName/PlanetDigital/Service/WCFServices/BoxSteering/Mp3TitleService.svc
- http://10.6.64.250/PlanetDigital/Service/WCFServices/BoxSteering/Mp3TitleService.svc
Here is the System.ServiceModel Tag from the web.config of the web site:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="Mp3PlayListServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> <behavior name="CommonDataServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> <behavior name="Mp3TitleServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> <behavior name="ExecutionPlanServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> <services> <service behaviorConfiguration="Mp3PlayListServiceBehavior" name="Mp3PlayListService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="IMp3PlayListService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <service behaviorConfiguration="CommonDataServiceBehavior" name="CommonDataService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="ICommonDataService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <service behaviorConfiguration="Mp3TitleServiceBehavior" name="Mp3TitleService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="IMp3TitleService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <service behaviorConfiguration="ExecutionPlanServiceBehavior" name="ExecutionPlanService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="IExecutionPlanService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> </system.serviceModel>
-
Thursday, July 30, 2009 7:22 AM
Hi,
The only difference I could find is dns tag:
<service behaviorConfiguration="Mp3TitleServiceBehavior" name="Mp3TitleService"><
endpoint address="" bindingConfiguration="LargeBuffer" binding="basicHttpBinding" contract="IMp3TitleService"> <identity><
dns value="localhost" /> </identity></
endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /></
service>and diagnostics tag before "behaviors" tag:
<diagnostics wmiProviderEnabled="false"><
messageLogging logMalformedMessages="false" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" /></
diagnostics>Please add this and check. Also try to debug your WCF Service to check whether you are getting data in WCF service.
HTH

-
Thursday, July 30, 2009 7:34 AM
Thanks for your quick reply, but nothing changed. Other ideas?
-
Thursday, July 30, 2009 7:47 AM
Are you able to get data from WCF Service with localhost ?
-
Thursday, July 30, 2009 7:57 AM
i can collect data through the wcf service with localhost but only if I am on the webserver per remote desktop.
-
Thursday, July 30, 2009 8:17 AM
Hi,
What do you mean by " webserver per remote desktop "?
Your project is on your machine? Are you using LinToqSQL ?
-
Thursday, July 30, 2009 8:34 AM
I'm developing on my local mashine and deploying it afterwards... to test it i surf the deploy-url and also check it directly on the webserver.
It's a windows server (2003 or 2008) for our IPTV-CMS.
On my local develop machine i do "Add service reference..." and when i deploy the hole solution I change the
1 <endpoint address="http://localhost:50670/PlanetDigital/Service/WCFServices/BoxSteering/ExecutionPlanService.svc" 2 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IExecutionPlanService" 3 contract="ExecutionPlanService.IExecutionPlanService" name="BasicHttpBinding_IExecutionPlanService" />
to
1 <endpoint address="http://10.158.64.250/PlanetDigital/Service/WCFServices/BoxSteering/ExecutionPlanService.svc" 2 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IExecutionPlanService" 3 contract="ExecutionPlanService.IExecutionPlanService" name="BasicHttpBinding_IExecutionPlanService" />
I thought that "localhost:50760" makes no sense on the webserver so i changed it to "10.157.64.250". I'm using Linq for some List<T> and Dictonary<T, M> Object, but no LinqToSql.
-
Thursday, July 30, 2009 8:47 AM
Hi,
Have you added Client policy ?
Check this link:
HTH

-
Thursday, July 30, 2009 9:40 AM
Maybe i found the reason. Our system is deliverd mostly to hotels. So when the reciptionist-lady call the application, she calls
--> http//192.168.0.xxx/Service/WCFServices/BoxSteering/Mp3TitleService.svc
When a developer connects to the system, he must connect over a vpn tunnel to the system and calls
--> http//10.xxx.64.250/Service/WCFServices/BoxSteering/Mp3TitleService.svc
When someone calls the application directly on the server he call
--> http//localhost/Service/WCFServices/BoxSteering/Mp3TitleService.svc
Can i detect the URL of the host-site in my silverlight application and pass the right sourceurl to the service at runtime
Can i pass 192.168.0.xxx or 10.xxx.64.250 or localhost at runtime to my service????
1 ExecutionPlanService.ExecutionPlanServiceClient service = new PlanetDigital.Silverlight.BoxSteering.ExecutionPlanService.ExecutionPlanServiceClient(); 2 service.GetReferencesCompleted += new EventHandler(service_GetReferencesCompleted); 3 service.GetReferencesAsync(DataSource.Id);
-
Friday, July 31, 2009 4:53 AM
I solved the problem... thanks for help

