我有一个相当紧迫的问题,我很欣赏任何意见。
我有一个这样定义的DomainService,一切正常(在开发机器和服务器上)。
Public Function GetPrices() As IQueryable(Of Price)
Public Sub InsertPrice(ByVal Price As Price)
Public Sub UpdatePrice(ByVal currentPrice As Price)
但是当我添加以下方法时,我在服务器上出现以下错误(在开发机器上没有出现)
<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
服务器是否可能有不同的WCF DLL?
答案 0 :(得分:1)
错误原因是由于GAC中安装了旧版本的RIA服务。最新的RIA Services Service Pack使用相同的版本号,这导致GAC中的版本优先于bin目录中的较新版本加载。
解决方案是从服务器卸载RIA服务,这将允许加载本地\ BIN版本。