Skip to main content
Home Forums Silverlight Programming Accessing Web Services with Silverlight Failed to generate code for the service reference
7 replies. Latest Post by Michael Knopf on November 3, 2009.
(0)
ScCrow
Member
44 points
107 Posts
12-14-2008 11:28 PM |
I have a solution with several projects, more than one of which call my WebService and they work. I added a new project to the solution, put some fields and a button on the screen. I recompile the solution, and there are no errors. When I try to add service reference to my WebService, I get the error below. Remove the Service reference and no errors. I also copied the clientConfig from one of the other projects over since the one being genereated is basically empty. And I copied a version to my base .Web project. I still get the errror.
Next, I added a new project, copied over all the code...it worked! For a few minutes. But now Im getting the same error again.
Currently, if I delete the clientConfig, and do an update service reference, the file only contains
<
And as stated, copying over a good clientConfig does not resolve the problem.
Error 7 Custom tool error: Failed to generate code for the service reference 'myWebSvc'. Please check other error and warning messages for details. D:\!SilverLight\IsildoSilverlight\Members\Service References\myWebSvc\Reference.svcmap 1 1 Members
Wardy
71 points
59 Posts
12-15-2008 6:34 PM |
D:\!SilverLight\IsildoSilverlight\Members\Service References\myWebSvc\Reference.svcmap <
12-16-2008 11:07 AM |
I now have 2 projects with this problem in this solution. The project compiles and runs if I dont try to reference the WebService in the code.(with the above error message).
I dont know if this helps any, but in the affected projects, I looked at the files in my Web Service. I see the usual files, I see Reference.Svcmap with a sub of Reference.vb but the two .datasource files are not being generated.
The two projects deal with login and member data, so Im not going to get much futher unless I can reference the WebService.
Update *** Ok, I totally reconstructed the project. Before copying over the code, I created all my Web references,etc. Once that was working, I copied over all the 10 projects code, resources,classes. etc.
It worked. That is until I needed to make a change to the WebService. I had to add a space to the end of a Select statement line. I recompiled the WebService, did an Update Service Reference ...BOOM. No .datasource files in some of the projects
On possible clue. All the user controls that are being called into another project are OK. Top level projects all are failing. So,,, Next I guess Im going to create a dummy project that does nothing but call the next projects.
ReConstructing the projects every time just isnt working for me!
12-21-2008 10:15 AM |
Well,, no responses. I have finally gotten a solution thats doesnt have this error. So, If your having this problem do this
Maybe I should just make the webservice a totally separate entity, but I am the ony one that would use it, so that seemed a additional complication.
One sort of unrelated note... You may have a solution that has a user control called in it, but itself is not using the web service. My project requires that I copy a clientConfig from another project. And then if you do a rebuild of the web service, you my have to update this as well.
Im rather new to Silverlight, but this has been a real pain and a lot of work time lost due to this issue.
So, not an answer, but perhaps a workaround that will save you some of the pain that I have encountered.
Im marking this as answered, although its not really. At best its a workaround.
lixin123
88 points
46 Posts
07-01-2009 4:22 AM |
Check this,
http://software-development-toolbox.blogspot.com/2009/02/creating-service-reference-failed-to.html
It really fixed the problem for me
klogan
5 points
5 Posts
07-15-2009 10:57 AM |
I'm having a similar problem. It was working then stop all of a sudden. I thought I'd post in hopes of helping someone else figure out their problem.
You can find what is causing the error following these steps. This utility also shows you all the activity that is taking place with your WCF service.
http://msdn.microsoft.com/en-us/library/ms732023.aspx1. Setup the web.config (or app.config) of the project the service is located in to save the trace<system.diagnostics> <trace autoflush="true" /> <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> <listeners> <add name="sdt" type="System.Diagnostics.XmlWriterTraceListener" initializeData="wcfTrace2.svclog" /> </listeners> </source> </sources> </system.diagnostics>a. initializeData can be a path.2. Download the svcviewer3. Setup the external tool in VS.a. C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\SvcTraceViewer.exe4. View the log to find problems and see what WCF is doing
monica_b...
4 points
2 Posts
07-30-2009 9:57 PM |
re: "silverlight Failed to generate code for the service reference"
I do something similar to ScCrow but it might be slightly easier.
1. Delete the service
2. Add it back with a new name that you never used before
3. Build (you will get errors for your reference) Check (e.g. with Intellisense) that the reference to the service exists
4. Delete the service
5. Add it back with the original name
6. It should work :)
Michael ...
11-03-2009 7:48 PM |
Here is another solution: I have had this exact same issue before. In the Properties for the project ensure that you do not have dot-seperated assembly names, in other words an assembly named MyProjects.MyAssemby because this can cause the issue. I was able to resole the issue by removing this the dot (so MyProjects.MyAssemby ==> MyProjectsMyAssembly) and then simply executed the "Update Service Reference". The Reference.cs file, which had been empty on previous attempts, was correctly populated and the service worked as it should have. Hope this helps others who run into this issue