We have number of WCF services running on Windows 2008, IIS7, .NET Framework 4.0 (Amazon EC2).
We can see the counters available in ServiceModelService 4.0.0.0
We are interested in more granular operation level counters so we enabled in the service.
Yet, despite doing this (also recycle the worker process) operation level (or endpoint counters) are still not showing up in perfmon: only service level are available.
Can you advise what could be the issue?
Thanks,
Piotr
Did you enable them in the config file?
<configuration>
<system.serviceModel>
<diagnostics performanceCounters="All" />
</system.serviceModel>
</configuration>
By default the performanceCounters setting is set to ServiceOnly
Also, they will only show up when the service is up and running.
We have moved the same WCF service to Windows 2008 R2 on EC2 and all counters show up properly now.
Configuration is identical. Perhaps there is some oddity on Windows 2008 SP2 and EC2.
Related
The setup
I have a WCF service hosted in IIS/AppFabric running on Windows Server 2012R2.
The service is bound to a local transactional MSMQ queue via netMsmqBinding. My operations are decorated with TransactionScopeRequired = true.
The service operations recieves calls from a BizTalk server, handles them and send responses back to a remote queue (on the same BizTalk Server), also via a netMsmqBinding.
<endpoint name="Outbound" address="net.msmq://int01test.mydomain.com/private/queue.name" binding="netMsmqBinding" bindingConfiguration="QueueBindingConfigurationOutbound" contract="My.Outbound.Contract" />
<netMsmqBinding>
<binding name="QueueBindingConfigurationOutbound">
<security>
<transport msmqAuthenticationMode="WindowsDomain" msmqProtectionLevel="Sign" />
</security>
</binding>
</netMsmqBinding>
In the testing environment this works as intended.
Physical setup in testing environment:
Server int01test.mydomain.com hosts a BizTalk server and my inbound queue. This runs under service account mydomain\inttestuser.
Server app01test.mydomain.com hosts my application (IIS/AppFabric), my database (SQL server) and my outbound queue. This runs under service account mydomain\apptestuser.
The problem
When this solution is promoted to the acceptance testing environment, calls are still handled, but the responses are blocked with error message:
System.ServiceModel.EndpointNotFoundException: An error occurred while
opening the queue:Unrecognized error -1072824317 (0xc00e0003). The
message cannot be sent or received from the queue. Ensure that MSMQ is
installed and running. Also ensure that the queue is available to open
with the required access mode and authorization. --->
System.ServiceModel.MsmqException: An error occurred while opening the
queue:Unrecognized error -1072824317 (0xc00e0003). The message cannot
be sent or received from the queue. Ensure that MSMQ is installed and
running. Also ensure that the queue is available to open with the
required access mode and authorization.
Differences
In the testing environment, my service and my database is running on a single server instance. (The BizTalk Server and it's queue, the target of my outbound messages, is on another server though)
In the acceptance testing environment, my solution is deployed on two load balanced servers and the database is on a separate cluster.
There are also more strict external firewall rules to mimic the production environment.
Even the BizTalk server is clustered, though we communicate machine-to-machine rather than cluster-to-cluster right now.
So setup in QA Environment is:
Server int01qa.mydomain.com (clustered with int02qa.mydomain.com) hosts a BizTalk server and my inbound queue. This runs under service account mydomain\intqauser.
Server app01qa.mydomain.com (clustered with app02qa.mydomain.com) hosts my application (IIS/AppFabric) and my outbound queue. This runs under service account mydomain\appqauser.
Server db01qa.mydomain.com hosts my database.
What we've already tried
We have disabled authentication on the remote queue.
We have granted full control to the account which my service is running under as well as to "everyone".
We have, successfully, sent msmq messages manually between the two servers.
I have configured my service to send responses to a local private queue, same error.
The problem turned out to be that MSMQ couldn't find a certificate for the app pool user. That is, the
0xc00e0003, MQ_ERROR_QUEUE_NOT_FOUND
was really caused by a
0xC00E002F, MQ_ERROR_NO_INTERNAL_USER_CERT
Changing security settings to
<transport msmqAuthenticationMode="None" msmqProtectionLevel="None" />
enabled messages to be sent.
The real solution, of course, is not to disable security but to ensure that the app pool users cerificate is installed in msmq.
We came across this issue and didn't want to disable authentication. We tried a number of different approaches, but it was something to do with the User Certificate not existing we think.
We went to the App Pool of the client application (which calls the WCF endpoint via MSMQ) and changed the Load Profile property to True. The call then worked. As an aside, changing it back to false continued to work - presumably because it had already sorted the certificate issue out.
Perhaps I am barking up the wrong tree - but I have a set of services (WebAPI and WCF) that use WebSphere MQ to interact with other systems.
This works without issue - until I now need to find a way of listening for messages on one of the queues.
Is this even possible, or do I need to go down the windows Service route?
You could write a Windows service that is continually calling MQ Get on the queue, and invokes a WCF service to process the message. Or you could write a trigger program (a console application) that MQ will launch for you when a message arrives, that invokes the WCF service.
I might be just better at googling than you are, but I seem to have found the answer here.
Seems you want to load the IBM binding configuration in you app.config
<extensions>
<bindingElementExtensions>
<add name="IBM.XMS.WCF.SoapJmsIbmTransportChannel"
type="IBM.XMS.WCF.SoapJmsIbmTransportBindingElementConfig, IBM.XMS.WCF, Version=7.5.0.0, Culture=neutral, PublicKeyToken=8c7c0be90afcd8ba"/>
</bindingElementExtensions>
</extensions>
Then you can add a WebSphere WCF binding config.
<bindings>
<customBinding>
<binding name="CustomBinding_WMQ">
<textMessageEncoding messageVersion="Soap11" />
<IBM.XMS.WCF.SoapJmsIbmTransportChannel />
</binding>
</customBinding>
</bindings>
Your problem can be broken down into two distinct elements:
How to integrate MQ with a WCF-supported transport
How to expose a WCF endpoint over this transport
To address the first issue, you should look at the MQ-MSMQ bridge which ships with Host Integration Server up to version 2009 (not R2), which allows you to have messages delivered to MQSeries queues forwarded to local MSMQs in windows. Although this feature is deprecated it's probably the easiest way if you have a MSDN license.
Another way of addressing this issue is to use BizTalk server which ships with a MQSeries adapter, though unless you're using BizTalk currently in your enterprise I would avoid.
The last way you could do this is to program directly against the MQSeries .NET client libraries or via the XMS client.
If you manage to solve the first issue then solving the second one is easy enough. You can expose one way WCF service operations over msmq transport by using the netMsmqBinding (for WCF on both ends), or msmqIntegrationBinding for clients using System.Messaging or native msmq COM libraries.
This in-effect acts as a listener service, with messages being handled by the service operation.
how to get connect with ibm websphere mq by using c#.net
Perhaps you could use the above answer and within that queue consumer app create a "Service Reference" to your WCF service.
I installed Appfabric Hosting Services. I created a xamlx Workflow Service. The workflow service sends emails based on a user's schedule. The Appfabric Persistence was working, but I unknowingly must have changed something, because it stopped persisting in the Appfabric database. The Workflow Service still works as long as I don't do an iisreset, which makes sense because the workflow is hosted in IIS.
I uninstalled AppFabric and re-installed it. In my root web.config, the InstanceStore is defined:
<instanceStores>
<add name="defaultSqlPersistenceStore" provider="SqlPersistenceStoreProvider" connectionStringName="ApplicationServerWorkflowInstanceStoreConnectionString" />
</instanceStores>
And the connectionStringName is defined. When I go to IIS and select the web application, I select configure from the Manage WCF and WF Services, and go to the Workflow Persistence tab. I select SQL Server Workflow Persistence and the SQL Server store drop down list is empty. If I select the computer name on the right in IIS and click Configure to setup Workflow Persistence, the defaultSqlPersistenceStore from above is in the drop down list. But that still doesn't help my Workflow service. In my Workflow Service web.config, I have:
<behavior name="Scheduler">
<sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll" instanceEncodingOption="GZip" instanceLockedExceptionAction="BasicRetry" connectionStringName="WorkflowPersistenceStore" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" />
<workflowInstanceManagement authorizedWindowsGroup="AS_Administrators" />
<workflowUnhandledException action="AbandonAndSuspend" />
<workflowIdle timeToPersist="00:01:00" timeToUnload="00:01:00" />
</behavior>
I tried adding a store to the WF service web.config:
<microsoft.applicationServer>
<persistence>
<instanceStores>
<add name="storeA" provider="SqlPersistenceStoreProvider" connectionStringName="WorkflowPersistenceStore" />
</instanceStores>
</persistence>
</microsoft.applicationServer>
and I'm able to select it in IIS - Configure WCF and WF Services, but my WF Service still doesn't persist.
When I check the Persistence database tables, the WF Service isn't even registered. (SELECT * FROM [System.Activities.DurableInstancing].[ServiceDeploymentsTable]). When persistence was working, there was a record with the WF Service url.
Thanks in advance,
-jason
I'm running AppFabric on IIS7 with Windows 7 for development.
AppFabric works fine for some period of time, but then it will stop updating.
I can send service requests through, and AppFabric doesn't show them in the dashboard when I refresh it.
I think a service is stopping, or there's a permission issue. Does anyone know what services are required to for AppFabric to run properly?
SQL Server and AppFabric Event Collection Service, off the top of my head (for event collection; there are other services, but since you say AppFabric itself runs requests, I presume they're OK). There's also Event Tracing for Windows, but it's not, strictly speaking, a service.
I presume you've also checked the tracking profile is set correctly and have looked in the Application event log?
I need to debug a WCF service but it needs to have an HTTP Context.
Currently I have a solution with a WCF service web site, when I click on debug it starts up and then fires up an html page that contains no test form.
While the project is running I tried starting the wcftestclient manually, then provided the address of my service, it finds the service but when I invoke it, it bypasses the IIS layer (or development server), so the httpContext is null...
What is the correct way to debug a WCF service through an IIS context?
In WCF, the HttpContext is set to NULL by default and by design, even if the WCF service is hosted in IIS; after all, WCF is not ASP.NET.
If you actually do need an HttpContext, you need to turn it on separately, through config (web.config if you host in IIS, your self-host app's app.config otherwise):
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
and you need to specify that fact (that your service allows or even expects the ASP.NET compatibility mode) by putting this attribute on your service class (that implements the service contract):
[AspNetCompatibilityRequirements
(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
public class MyWCFService : IMyWCFService
{
......
}
RequirementsMode=Allowed just simply allows the ASP.NET compatibility mode, while RequirementsMode=Required actually requires is and will not work without it.
Once you do that, you should get your HttpContext.Current when you attach your debugger to the IIS worker process.
Marc
You will have to attach your debugger (Visual Studio) to the IIS service process.
In Visual Studio, go to Debug -> Attach to process and select the IIS process in the Attach to Process dialog.
On IIS7, the name of the process is w3wp.exe, but you may need to select the Show processes from all users or Show process in all sessions before it becomes available.
When the debugger is properly attached to the IIS process, you can set one or more breakpoints in your code and invoke the service.
You must attach to the IIS process, namely aspnet_wp.exe under XP and w3wp.exe on 2003 server. This way you will hit breakpoints etc.
If you are looking for a way to test the WCF service itself, I would suggest using WcfTestClient.
And remember that the IIS process won't show in the task manager until you hit the server at least once (for example after a reboot, you'll have to hit a page on the server at least once to make the process start).
Thanks for the Solutions. I was getting the same problem.
My Solution is Working fine now with 2 svc files.
In Order to solve the problem i made two changes
In Web.Config I Commented the Line
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
and
Added Attribute [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] on the classs that are implementing the Interfaces.