Search code examples
silverlightwcf-ria-services

WCF Ria Operation does not conform to the required signature


I've a rather pressing matter that I'd appreciate any input.

I've a DomainService which is defined thus, and everything works fine (on Development machine and Server).

Public Function GetPrices() As IQueryable(Of Price)
Public Sub InsertPrice(ByVal Price As Price)
Public Sub UpdatePrice(ByVal currentPrice As Price)

But when I add the following method, I get the following error on the server (which doesn't occur on the development machine)

<Invoke(HasSideEffects:=True)>
Public Sub SetSitePrices(ByVal SiteIds As IEnumerable(Of Short), p As Price)

Operation named 'SetSitePrices' does not conform to the required signature. Parameter types must be an entity type or one of the predefined serializable types.

[InvalidOperationException: Operation named 'SetSitePrices' does not conform to the required signature. Parameter types must be an entity type or one of the predefined serializable types.]
   System.ServiceModel.DomainServices.Server.DomainServiceDescription.ValidateMethodSignature(DomainOperationEntry method) +221051
   System.ServiceModel.DomainServices.Server.DomainServiceDescription.AddInvokeOperation(DomainOperationEntry method) +21
   System.ServiceModel.DomainServices.Server.DomainServiceDescription.Initialize() +312
   System.ServiceModel.DomainServices.Server.DomainServiceDescription.CreateDescription(Type domainServiceType) +216
   System.ServiceModel.DomainServices.Server.<>c__DisplayClass8.<GetDescription>b__7(Type type) +9
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
   System.ServiceModel.DomainServices.Server.DomainServiceDescription.GetDescription(Type domainServiceType) +196
   System.ServiceModel.DomainServices.Hosting.DomainServiceHost..ctor(Type domainServiceType, Uri[] baseAddresses) +250
   System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +29
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +422
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1461
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651

[ServiceActivationException: The service '/Services/Cosmo-Web-SamDomainService.svc' cannot be activated due to an exception during compilation.  The exception message is: Operation named 'SetSitePrices' does not conform to the required signature. Parameter types must be an entity type or one of the predefined serializable types..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +688590
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
   System.ServiceModel.Activation.ServiceHttpHandler.EndProcessRequest(IAsyncResult result) +6
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +96

Is it possible that the server has different WCF DLLs?


Solution

  • The cause of the error is due to an old version of RIA Services installed in the GAC. The latest RIA Services Service Pack uses the same version number, and this caused the version in the GAC to load in preference to the newer version in the bin directory.

    The solution is to uninstall RIA Services from the server and that will allow the local \BIN version to load.