Skip to main content
Home Forums Silverlight Programming Programming with .NET - General SL2B2 WCF Web Services Error
15 replies. Latest Post by ptangyangkipperbang on October 8, 2008.
(0)
digitalml
Member
34 points
25 Posts
06-10-2008 4:08 PM |
This worked fine in beta 1, and now when i add a reference to web service in beta 2 and instantiate a new instance of that service i get this error the runtime
"Could not find default endpoint element that references contract 'Namespaces.IEgmWebManager' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."
Everything is the same as it has been since beta 1. The end points all look good in the ServiceReferences.ClientConfig file which as I understand it is now used.
If you have any ideas please let me know.
ThanksDML
sladapter
All-Star
17439 points
3,172 Posts
06-10-2008 4:32 PM |
Read this thread. Have you updated your clientaccesspolicy file if you are doing cross-domain call?
http://silverlight.net/forums/t/17733.aspx
06-10-2008 4:42 PM |
Yes, the clientaccesspolicy.xml and crossdomain.xml are updated and in the root as they should be, but this is not the problem... The error happens right when I instantiate a new instance of the webservice, eg: MyWebService ws = new MyWebService();
06-10-2008 4:45 PM |
Then it's a different problem. Can you add Service Reference or you have not tried that? Try to add Service Reference and report back. You might have another install problem.
06-10-2008 5:00 PM |
Already dealt with the service reference add problem a few days back, reinstalled and I can add service references fine now. This only happens at runtime when the service is instantiated. Any other ideas? :)
06-10-2008 5:24 PM |
Then check your ServiceReferences.ClientConfig, see if you have more than one end points defined for this service. I have seen this problem, more than one end point being added in the ClientConfig. Use WCF Service Configuration Editor to do any editing on the ServiceReferences.ClientConfig file. Make sure the url in end point is valid. Binding is correct.
06-10-2008 5:34 PM |
Here is my ServiceReferences.Client.Config file, everything looks good to me... <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="egmWebManager" maxBufferSize="65536" maxReceivedMessageSize="65536"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://10.128.106.92/egmwebmanager" binding="basicHttpBinding" bindingConfiguration="egmWebManager" contract="Namespaces.IEgmWebManager" name="egmWebManager" /> </client> </system.serviceModel></configuration>
06-10-2008 5:35 PM |
Sorry no extra period is in the ServiceReferences.ClientConfig file name it was a typo...
06-10-2008 5:44 PM |
I don't see anything wrong.
the "Namespaces" in contract should be the real namespace of your WCF, right?
contract="Namespaces.IEgmWebManager" ,
Can you put Try/Catch to see what is in the Exception?
OK I looked at your error message again. Is "Namespaces.IEgmWebManager"
Is your WCF namespace really called "Namespaces" ? Maybe that is the problem. Give it a real namespace. "Namespaces" could be a key word in .Net.
06-10-2008 5:58 PM |
Yes, "Namespaces" is simply a placeholder I have added to these posts as I'd prefer not to list my actual namespaces. The error I posted in the orginal post is the error from the try catch and has no inner exception information.
06-10-2008 6:09 PM |
You can try to remove your Service Reference and re-add them back.
ptangyan...
14 points
2 Posts
06-11-2008 11:41 AM |
In SL2B1 this worked:-
Dim service1 As New myWebService.MyWebServiceSoapClient()
The auto-generated Reference.vb in SL2B2 no longer applies default values for binding and endpoint address when calling New() with no parameters.
So, something like this is now required:-
Dim service1 As New myWebService.MyWebServiceSoapClient(New System.ServiceModel.BasicHttpBinding, New System.ServiceModel.EndpointAddress("http://TheFullEndPointAddressOfYourService"))
Hope this helps.
- qfwp
06-11-2008 6:53 PM |
So even though the above answer relates to visual basic and I'm using c# it got me thinking about the way I am loading my xap's.
We are using a module based type architecture and load xap's dynamically through a WebClient call and LoadAssemblyFromXap(). Each xap has its own web service reference and thus its own ServiceReferences.ClientConfig file. Well since beta 1 didn't use this file at all I never considered it a problem. Now that beta 2 uses the ServiceReferences.ClientConfig file it made sense to me that as long as each xap had this file the service references would be fine. That's where my misconception was... Turns out that the Silverlight application (xap) that loaded the other xap's via LoadAssemblyFromXap() must have the endpoints that the other xap's use defined in its ServiceReferences.ClientConfig file as well.While this makes sense it also seems a bit off to me... What this essentially means is that my main Silverlight application must always know about any web service references inside of any other xap's I load dynamically, which doesn't make for a very good module / plug n play approach.
So whats the answer? I could do as the above post suggests and hard code / supply the constructor of the service with the end point information but again that defeats the whole power of the config file. What I've ended up doing is reading the config file manually from the xap I've loaded throwing that into some variables and then supplying that to the constructor of the service references in the dynamically loaded xap's so that my main Silverlight application's ServiceReferences.ClientConfig file never needs to know about them and I can still maintain the dynamic plug n play architecture I've built.Like i said earlier, while this makes sense to me, it also feels a bit off. Is there a better way to load xap's dynamically? I expected that each xap would refer to the ServiceReferences.ClientConfig file embedded within it rather than look for it where LoadAssemblyFromXap() was called from. Perhaps someone from Microsoft could please explain the architecture behind this?Thanks for everyone's help...DML
phillipi
6 points
7 Posts
07-02-2008 10:42 PM |
This is a great post. I was just going to pull out my hair for a simple HelloWorld app that utilizes WCF proxy to get a response from the server. The WCF Silverlight Tutorial on this website shows for the former implementation and is apparently now outdated. Phillip
zenuke
50 points
61 Posts
10-07-2008 8:09 AM |
can you explain what you mean by the fullendpointaddressofyuorservice??
10-08-2008 6:00 AM |
It's the URL of your web service.
In my current project, for example, it's http://localhost:1955/svcMain.asmx