wcf binding - How to create a wsdl file for a WCF service library? -


i have wcf service library project. trying generate wsdl file launching wcf test client running in visual studio (pushed f5). launched wcf test client says "failed add service. service metadata may not accessible. make sure service running , exposing metadata.". gives me below error message.

c:\users\xxx\appdata\local\temp\test client projects\10.0\354421b1-b65e-45fc-8d98-ac87254a5903\client.cs(911,26) : error cs0644: 'system.componentmodel.propertychangedeventhandler' cannot derive special class 'system.multicastdelegate'

i added servive behavior expose metadata follows. not sure else missing here able generate wsdl file. help!

<services>   <service name="cu.customer" behaviorconfiguration="metadata">     <endpoint address="" binding="wshttpbinding" contract="cu.icustomer">       <identity>         <dns value="localhost"/>       </identity>     </endpoint>     <endpoint name="mex" address="mex" binding="mexhttpbinding" contract="imetadataexchange"/>     <host>       <baseaddresses>         <add baseaddress="http://localhost:8732/design_time_addresses/customerservice/service1/"/>       </baseaddresses>     </host>   </service> </services> <behaviors>   <servicebehaviors>     <behavior name="metadata">       <!-- avoid disclosing metadata information,        set value below false , remove metadata endpoint above before deployment -->       <servicemetadata httpgetenabled="true"/>       <!-- receive exception details in faults debugging purposes,        set value below true.  set false before deployment        avoid disclosing exception information -->       <servicedebug includeexceptiondetailinfaults="false"/>     </behavior>   </servicebehaviors> </behaviors> 

there nothing wrong metadata bindings, have compiler error in service. preventing wcf building service class, needs expose metadata endpoint.

fix error first:

'system.componentmodel.propertychangedeventhandler' cannot derive special class 'system.multicastdelegate'

the error (note it's in temp file) happening when wcf trying compile service contracts locally classes can use access service. means you're running legal in c#, not legal in wcf. likely, given error, have class implements inotifypropertychanged being used data contact in operation contract.

note every class gets serialized across wcf channel data contract. typically decorate class datacontract , each field datamember attributes, directs serializer how handle class. if don't, , include class parameter or return value in operationcontract, wcf pretends put attributes on every public field in class.

in case, guess have class, passing in or out of service call, has:

 public event propertychangedeventhandler propertychanged; 

that public field, unless tell wcf otherwise, try serialize part of implicit data contract. there types cannot serialized way, , multicastdelegate 1 of them.

to fix, , in future avoid, problem, always decorate types use services datacontract , datamember explicitly. it's safe put attributes on class -- if never try serialize it, attributes ignored.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -