I have a WCF service service that runs good while hosted in local IIS, but gives the following exception when hosted in an Azure VM IIS :
DispatchOperation requires Invoker.
Exception Details: System.InvalidOperationException: DispatchOperation requires Invoker
StackTrace :
[InvalidOperationException: DispatchOperation requires Invoker.]
System.ServiceModel.Dispatcher.DispatchOperationRuntime..ctor(DispatchOperation operation, ImmutableDispatchRuntime parent) +17276262
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime..ctor(DispatchRuntime dispatch) +824
System.ServiceModel.Dispatcher.DispatchRuntime.GetRuntimeCore() +114
System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpened() +520
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +766
System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +260
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +742
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +126
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901
[ServiceActivationException: The service '/PidPlusService.svc' cannot be activated due to an exception during compilation. The exception message is: DispatchOperation requires Invoker..]
System.Runtime.AsyncResult.End(IAsyncResult result) +650220
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210733
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282
I have the svc file, web.config file and the dlls that are there in the service. The service project is a class library project and is part of a solution that generates the dlls.
Is there something that needs to be changed in code for hosting in Azure? Or is it a configuration issue?
You will have to configure the Virtual Machine to support WCF, just as you did your local on-premise IIS machine. Insure that these settings are configured on your VM in Azure.
Additionally, you may need to enable in Windows Features 'WCF Http Activation' (.NET Framework 3.5). If you're targeting .NET Framework 4.5, then make sure 'WCF Services' (.NET Framework 4.5 Advanced Services) is enabled.
Related
I've developed a WCF Service which is hosted as a Windows Service and exposes a MSMQ endpoint.
I have the client app on SERVER1, and the MSMQ and WCF Service on SERVER2.
When the SERVER1/ClientApp attempts to push a message on to the SERVER2 MSMQ, I get the following errror:
System.TypeInitializationException: The type initializer for 'System.ServiceModel.Channels.Msmq' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'mqrt.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at System.ServiceModel.Channels.UnsafeNativeMethods.MQGetPrivateComputerInformation(String computerName, IntPtr properties)
at System.ServiceModel.Channels.MsmqQueue.GetMsmqInformation(Version& version, Boolean& activeDirectoryEnabled)
at System.ServiceModel.Channels.Msmq..cctor()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.Msmq.EnterXPSendLock(Boolean& lockHeld, ProtectionLevel protectionLevel)
at System.ServiceModel.Channels.MsmqOutputChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [7]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at FacilityManager.Service.NotificationsProcessorServiceReference.INotificationsProcessor.SendNewReactiveTaskNotifications(NewReactiveTaskDataContract newReactiveTaskDataContract)
Both SERVER1 and SERVER2 are running Windows Server 2008 R2 Enterprise (6.1 SP1), and both have had MSMQ installed via the Add Features in Server Manager.
I understand that the DLL is missing (fairly obvious from the error!), but I've no idea what I should be installing to get the dll where it should be.
A search in Windows Explorer shows that the DLL is present in the following directories on both servers....
C:\Windows\System32
C:\Windows\SysWOW64
C:\Windows\winsxs\x86_microsoft-windows-msmq-runtime-core_31bf3856ad364e35_6.1.7601.17514_none_5768e2ad17453bd6
C:\Windows\winsxs\amd64_microsoft-windows-msmq-runtime-core_31bf3856ad364e35_6.1.7601.17514_none_b3877e30cfa2ad0c
Any help appreciated.
An obvious aside; If you don't have the Windows Feature -> Microsoft Message Queue (MSMQ) Server installed then you will get this error. Simply go to Programs and Features and then Turn Windows Feature on or off.
I'm none the wiser but things are working now.
After hours on SO and Google, I ended up just checking that MSMQ was installed on both Servers by writing a quick console application with the code grabbed from here...
https://stackoverflow.com/a/16104212/192999
I ran the console app on both Server1 and Server2 and both came back with a result of True to IsMsmqInstalled.
I then ran my application and the "Unable to load DLL 'mqrt.dll'" error was no longer being raised.
I don't know if the call to NativeMethods.LoadLibrary("Mqrt.dll"); registered the DLL or something, but it certainly fixed my problem.
I hope this helps someone in the future!
This can be caused by your service on SERVER2 starting up and finishing its initialization before MSMQ is done initializing itself. The easiest way to test this is to restart the service hosting the WCF MSMQ endpoint. If the WCF service is hosted in IIS, perhaps bouncing the app pool will do the same thing, but I do not know for sure -- I've never dealt with an IIS hosted MSMQ endpoint.
If restarting the service fixes your problem and your own service is a Windows service, you can then add MSMQ as a dependency to your own service so that it will delay its startup until MSMQ is ready. This answer on Server Fault describes how to do it. Incidentally, the service you want to depend on is called "Message Queueing"
NHibernate.Caches.Appfabric nuget package for using Azure AppFabric Caching service as the second level cache for NHibernate was working fine with V 1.8 of the Azure SDK.
However after upgrading to VS 2012 and version 2.0 of the Azure SDK the nuget package has stopped working and the AppFabric DLL is unable to Establish Connection with the Azure AppFabric Caching service.
We get the following error when connecting to the Azure AppFabric Caching service:
Exception type: DataCacheException
Exception message: ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.). Additional Information : The client was trying to communicate with the server: net.tcp://192.168.171.9:20005.
at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination)
at Microsoft.ApplicationServer.Caching.DataCacheFactory.EstablishConnection(IEnumerable1 servers, RequestBody request, Func3 sendMessageDelegate, DataCacheReadyRetryPolicy retryPolicy)
at Microsoft.ApplicationServer.Caching.SocketClientProtocol.Initialize(IEnumerable1 servers)
at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName, CreateNewCacheDelegate cacheCreationDelegate, DataCacheInitializationViaCopyDelegate initializeDelegate)
at NHibernate.Caches.AppFabric.AppFabricCacheFactory.GetCache(String cacheName, Boolean useDefault)
at NHibernate.Caches.AppFabric.Adapters.AppFabricCacheNamedAdapter.GetCache(IAppFabricCacheFactory cacheFactory)
at NHibernate.Caches.AppFabric.AppFabricCacheAdapter..ctor(String regionName)
at NHibernate.Caches.AppFabric.Adapters.AppFabricCacheNamedAdapter..ctor(String regionName)
at NHibernate.Caches.AppFabric.AppFabricCacheAdapterFactory.Create(String regionName)
at NHibernate.Caches.AppFabric.AppFabricProvider.BuildCache(String regionName, IDictionary2 properties)
at NHibernate.Cache.CacheFactory.CreateCache(String usage, String name, Boolean mutable, Settings settings, IDictionary`2 properties)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners)
=====================================================
Can you please suggest how to resolve this issue??
Thanks
According to the walk-through the mentioned exception is mainly thrown due to either of the two reasons
Accounts access to AppFabric.
Mismatch in the security credentials of Server and client configurations.
Having said that the study I'm referring to is not for azure, but still I hope it is off assistance. Refer to the link below,
http://blogs.msdn.com/b/mspfe/archive/2013/03/22/the-case-of-the-broken-appfabric.aspx
We can't determine why the Azure BasicHttpRelay is throwing an occasional FaultException without any details. We've enabled WCF diagnostic tracing, but the available stack trace information is still the same. It seems like the WCF client channel fails for a brief time and then shortly returns.
We do cache the WCF Channel (e.g. CreateChannel), but this is the first time we've experienced this strange behavior. We have other Azure Service Bus relay solutions that work fine with this approach.
Error Message:
There was an error encountered while processing the request.
Stack Trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at [our WCF method]...
FaultException - FaultCode Details:
Name: ServerErrorFault
Namespace: http://schemas.microsoft.com/netservices/2009/05/servicebus/relay
IsPredefinedFault: false
IsReceiverFault: false
IsSenderFault: false
Soap Message
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/netservices/2009/05/servicebus/relay">a:ServerErrorFault</faultcode>
<faultstring xml:lang="en-US">There was an error encountered while processing the request.</faultstring>
<detail>
<ServerErrorFault xmlns="http://schemas.microsoft.com/netservices/2009/05/servicebus/relay" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Through debugging, we can see the server properly responds to the message requests (via IDispatchMessageInspector), but the client fails to handle the response appropriately (IClientMessageInspector reports fault). Subsequent relay requests will succeed after the client channel seemingly corrects itself. These failures seem to be intermittent and not load-driven. We never see these FaultException errors using basicHttpBinding outside the Azure relay.
Does anyone have any suggestions? We are using Azure SDK 1.8.
I've tried configured a new Service Bus Relay namespace using owner shared secret, but still seeing the same results.
After reaching out to MS - this issue turned out to be an MS bug with the Relay or the SDK, specifically when using Http Connectivity Mode. At this point, the only workaround is ensure you have the appropriate outgoing TCP ports opened up to ensure reliable connectivity with the Azure Relay.
Allow Outgoing TCP Ports: 9350 - 9354
MS has told us that they are still working on resolving the root cause. Hopefully this workaround will help others. Our corporate firewall had these TCP ports blocked which forced all communication over port 80 which must trigger this issue. The positive thing is that opening up these ports enables faster connectivity to the relay when starting up your listeners (AutoDetect doesn't have to check the TCP ports availability every time).
I have hosted a WCF service inside a Windows service using C#. It works fine and I was able to communicate with the WCF service from a client application.
But the issue is if I leave the client idle for 10 min or so and then try to connect again, I get the following error
Server stack trace:
at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
Object[] outs, TimeSpan timeout)
It is not the windows service that is down, it is your client proxy.
You say that you leave the client idle. You should not do this. You should close the client after you have made your request. Then open it when needed.
This happends when your service binding ReceiveTimeout setting is left at its default value (10 minutes).
To set this to "forever", you can set in your config file:
ReceiveTimeout = "infinite"
or by code:
binding.ReceiveTimeout = TimeSpan.MaxValue;
We created WCF services hosted on various windows services. During consumption of the WCF service by another windows service, initially everything goes successfully. But after continuous execution for a day, it suddenly throws the following exception:
The error message is Could not find endpoint element with name 'MemoryClient' and contract 'IQueue.IRepository' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
The source of the exception System.ServiceModel
The stack trace of the exception:
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ChannelFactory1..ctor(String endpointConfigurationName)
at EngineChannelFactory.RepositoryClient.CreateNewChannel(String strEndPoint)
THE TARGET SITE OF EXCEPTION -> Void LoadChannelBehaviors(System.ServiceModel.Description.ServiceEndpoint, System.String)
The problem is, it is consuming this same end point for some time. Once the service restarts, the issue is resolved. Has anyone faced this issue? This is happening on Windows 2003 64 Bit Server, where .NET 3.5 is installed. Has someone said if this is an environment issue, and was fixed in .NET 3.5 SP1?
Thank you in advance.