Showing posts with label wcf. Show all posts
Showing posts with label wcf. Show all posts

Friday, 28 September 2012

WCF Service Reference Error

I tried updating my WCF service references in my web project and received this strange error:

Error        265          Missing partial modifier on declaration of type 'xyz'; another partial declaration of this type exists   Reference.cs

This mean't I had a class in the service or the web projects that are named the same but are not set as partials. The problem was in the service project the complex object in my EF 4 entities did not generate a partial class when referenced in the References.cs file of the web project.

I had to configure the service reference to reuse the System assembly, then update my reference again and everything worked - strange error :(

This post helped me a bit http://stackoverflow.com/questions/8542514/wcf-reference-cs-suddenly-not-including-classes

Friday, 19 June 2009

Add web reference as a service reference

With the introduction of WCF I am attempting to add my existing web service (ASMX) to a class library but using WCF service references.

So I have this web service URL i.e. http://localhost/ChoicesSurveyWS/SurveyWS.asmx
  • I create a new class library project.
  • I right-click on the new class library and select "Add service reference".
  • A dialog pops up and I place my web service URL into the "Address" bar.
  • Click "Go".
  • Type in a new namespace name i.e. SurveyService.
  • Click "Ok".


Now a service reference is added to the project and an app.config file.
  • Create a new console project to be the client (consumer) of the web service.
  • Add the class library we created as a project reference to the console project.

*NB* MOVE THE app.config FILE FROM the class library into the console project. This will prevent you getting an error like this:

Could not find default endpoint element that references contract in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element match