I have a project using WCF which was working fine, but I moved the code to another machine and now it will not compile. I get errors for lines of code like this, where I instantiate a class and then call a service client:
FlooringReportingServiceClient.FlooringReportingServiceClient client = new FlooringReportingServiceClient.FlooringReportingServiceClient();
BusinessCollectionResponse<Store> storeCollectionResponse = client.GetStoreList((bool)Session["IsAdmin"]);
The errors will say
Cannot implicitly convert type ‘MyCompany.Presentation.FlooringReporting.FlooringReportingServiceClient.BusinessCollectionResponseOfRoleW6bohhDP’
to
‘MyCompany.Architecture.Framework.Common.BusinessCollectionResponse’
The string “OfRoleW6bohhDP” gets appended from who knows where.
I know that about a year ago I was talking with a guy at a party about WCF (I know, boring party) and he mentioned something about when random letters get appended to the end of a class name then you have to do “x” to fix it. But I cannot remember what that is, and I have not been able to find anything like this on the web. I am no expert at WCF, I am using someone else’s framework, so forgive me if this is a simple question.
It seems like types with similar names are getting mismatched. In the client application, do you have a reference to the library (project) that contains the WCF data contracts (parameters or return types of your WCF operations)?
If you do, you may be mismatching the actual types and their proxies auto-generated while adding the service reference.
While adding or updating (Configure Service Reference) the service reference, you can tell visual studio whether to reuse the types in the referenced libraries instead of generating new ones.