Adding a WCF service reference

Topics: Writing modules
Jun 23, 2011 at 8:51 PM

Is there anything specific you need to do when adding a WCF service reference to an Orchard MVC module?  I've successfully tested my module with a hard coded DAL, but as soon as I add a service reference I get an exception.

Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.

I've verified System.Runtime.Serialization is referenced in both my module and the Orchard.Web module.

Jun 24, 2011 at 6:43 AM

Maybe you can add a reference to that SystemRuntime.Serialization in you Project. After, or if you already have that added, make sure to set in the Proprieties Windows-> Copy Local, property, to true..

 

See if that fixes the issue.

Jun 24, 2011 at 4:58 PM

Thanks for the suggestion!  That didn't directly resolve the issue, but it did help me get a step further.  After changing Copy Local to true I got a type mismatch exception.  It turns out that another one of my references was built with .NET 3.5 and was using an older version of System.Runtime.Serialization.  As soon as I removed this reference everything worked great.

Jun 24, 2011 at 5:24 PM

I would like to add a Service Reference to my Module as well and am wondering about best practices. Is it best to just add my own or is there some Orchard-approved way of doing it to take advantage of the Orchard authentication/authorization system. Is there some module that already exists for this?