I keep seeing this error on few of our environments:
System.ServiceModel.ServiceActivationException: Request to the service
at '~/TmpServ.svc' cannot be dispatched because the virtual
application at '/TmpServ' is shutting down.
--- End of inner exception stack trace --- at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.FailActivationIfRecyling(String
normalizedVirtualPath) at
System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath, EventTraceActivity eventTraceActivity) at
System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String
relativeVirtualPath, EventTraceActivity eventTraceActivity)
We are using IIS 7;
the load on the Web server is low, but the error still appears a few times a day.
Any suggestions ?
In IIS: Increase Process Model / Idle Time-out or set Idle Time-out Action to Suspend. Set Recycling / Regular Time Interval (minutes) to 0.
Use Windows Services to host your WCF service if you can.
Related
I have problem with a windows client certificate, on a system I have inherited from a developer who left without documenting his work. Basically, when I try to connect to an IIS hosted webservice using Postman, I am told in the event log that
Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue 'THUMBPRINTVALUE'
Now I have installed the certificate into all the places I can think of.
Here is a more detailed description of what I've done.
I have a IIS hosted WCF service which is exposed to the internet via a firewall. The URL of the WCF service is bound to a receive location on BizTalk server 2013r2, the receive location is of Type WCF-WebHttp, and a client certificate has been set for the receive location.
I am using postman to connect to the above URL, having registered the client certificate with postman as the documentation describes, and I get the following error page returned
HTTP Error 500.0 - System.ServiceModel.ServiceActivationException
In the event log viewer I get the following entry:
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/62476613
Exception: System.ServiceModel.ServiceActivationException: The service '/HL7/ORU/R01/HTTPBasic/Service1.svc' cannot be activated due to an exception during compilation. The exception message is: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue '*THUMBPRINTVALUE*'.. ---> System.InvalidOperationException: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindByThumbprint', FindValue '*THUMBPRINTVALUE*'.
at System.ServiceModel.Security.SecurityUtils.GetCertificateFromStoreCore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, Object findValue, EndpointAddress target, Boolean throwIfMultipleOrNoMatch)
at System.ServiceModel.Security.SecurityUtils.GetCertificateFromStore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, Object findValue, EndpointAddress target)
at System.ServiceModel.Security.X509CertificateRecipientServiceCredential.SetCertificate(StoreLocation storeLocation, StoreName storeName, X509FindType findType, Object findValue)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.BtsServiceHostBase.SetServiceCertificate()
at Microsoft.BizTalk.Adapter.Wcf.Runtime.BtsServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
--- End of inner exception stack trace ---
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
Process Name: w3wp
Process ID: 7080
I know what this error means, that it can't find a certificate with a thumbprint THUMBPRINTVALUE in StoreName 'My', StoreLocation 'CurrentUser'.
In this case, who is CurrentUser, I have added the certificate thumbprint THUMBPRINTVALUE to the following users, who are all the ones I think of that are associated with the webservice.
IIS Service Account
BizTalk Service account
The user associated with the application pool the IIS hosted WCF service
What am I missing?
HTTP 500 error typically indicates that there is something wrong with the server running state. It has none business with the client-side.
There is indeed a service that authenticates the client with a certificate. In that case, we need to provide a client certificate to invoke the service. However, from the error message, there is a problem with the WCF on the server-side. Before calling, please confirm whether the service is running normally. I suggest you visit the below URL page in the browser to check whether the service is running properly.
https://myserver/service1.svc
Result.
For the WCF hosted in IIS requires a service certificate, this is commonly accomplished by the site binding module in IIS.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl
Feel free to let me know if there is anything I can help with.
I installed AD FS 3.0 with a default configuration on a server where IIS was already installed. Every time the service is started, it complains about not being able to bind the IP endpoint 0.0.0.0:808.
Here is an excerpt from event log:
Source: AD FS
Event id: 102
Description:
There was an error in enabling endpoints of Federation Service. Fix configuration errors using PowerShell cmdlets and restart the Federation Service.
Additional Data
Exception details:
System.ServiceModel.AddressAlreadyInUseException: There is already a listener on IP endpoint 0.0.0.0:808. This could happen if there is another application already listening on this endpoint or if you have multiple service endpoints in your service host with the same IP endpoint but with incompatible binding configurations. ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.ServiceModel.Channels.SocketConnectionListener.Listen()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SocketConnectionListener.Listen()
at System.ServiceModel.Channels.ConnectionAcceptor.StartAccepting()
at System.ServiceModel.Channels.ExclusiveTcpTransportManager.OnOpen()
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TcpChannelListener`2.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at Microsoft.IdentityServer.ServiceHost.STSService.StartSTSService(ServiceHostManager serviceHostManager, ServiceState serviceState)
AD FS 3.0 has a serious bug when it tries to bind the default services port 1501. It actually ignores the setting and tries to bind on the default net.tcp port 808 by stripping the port away from the URI if it is configured to 1501. To get things worse this binding is hard-coded and therefore port sharing can't be configured for this.
I used this technet article to change the port to 1502 and all seems to work like a charm.
To change the services net.tcp port from 1501 to 1601
Launch PowerShell
Add the AD FS 2.0 PowerShell snap-in:
add-pssnapin microsoft.adfs.powershell
Configure the Services net.tcp port via the Set-ADFSProperties cmdlet:
Set-ADFSProperties -nettcpport 1601
Confirm the change:
Get-ADFSProperties
Restart the AD FS 2.0 service in the Services console
We're seeing this error in a customer environment with our WCF services.
We haven't been able to reproduce in house with the same Dlls and web.config settings. Therefore, I'm assuming it's an issue with the environment.
Any suggestions for things to check on the server?
This is the error we're seeing when browsing to any of the .svc files:
[InvalidOperationException: The AutofacServiceHost.Container static
property must be set before services can be instantiated.]
Autofac.Integration.Wcf.AutofacHostFactory.CreateServiceHost(String
constructorString, Uri[] baseAddresses) +478
System.ServiceModel.HostingManager.CreateService(String
normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1429
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo
serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
System.ServiceModel.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath, EventTraceActivity eventTraceActivity) +598
Solved. The customer environment was missing the global.asax file. :(
I use the service bus configuration wizard and, while everything seems fine during validation, in the end I get this:
[Error] [20/2/2014 11:07:14 ]: System.Management.Automation.CmdletInvocationException: The server could not be contacted. ---> System.DirectoryServices.AccountManagement.PrincipalServerDownException: The server could not be contacted. ---> System.DirectoryServices.Protocols.LdapException: The LDAP server is unavailable.
at System.DirectoryServices.Protocols.LdapConnection.Connect()
at System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
--- End of inner exception stack trace ---
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval()
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password)
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType)
at System.DirectoryServices.AccountManagement.UserPrincipal.get_Current()
at Microsoft.ServiceBus.Commands.ServiceBusBaseCmdlet.CreateAdminGroup(String adminGroup)
at Microsoft.ServiceBus.Commands.NewSBFarmBase.ProcessRecordImplementation()
at Microsoft.ServiceBus.Commands.ServiceBusBaseCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
at Microsoft.ServiceBus.ConfigWizard.CommandletHelper.InvokePowershell(Command command, Action`3 updateProgress)
at Microsoft.ServiceBus.ConfigWizard.ProgressPageViewModel.CreateSBFarm(FarmCreationModel model)
Ideas anyone?
EDIT:
I have tried disabling my firewall completely, I enabled and started the "SQL Server Browser" service, tested my credentials, and I am completely clueless...
(I also have the SQL Server instance on my local machine, if that matters)
EDIT2:
After trying with another user account (the one I was inserting in the wizard) I got this:
[Error] [21/2/2014 10:24:39 πμ]: System.Management.Automation.CmdletInvocationException: Starting service Service Bus Gateway on machine TURBOX-PC failed: Time out has expired and the operation has not been completed. ---> Microsoft.ServiceBus.Commands.Common.Exceptions.OperationFailedException: Starting service Service Bus Gateway on machine TURBOX-PC failed: Time out has expired and the operation has not been completed. ---> System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.
at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout)
at Microsoft.ServiceBus.Commands.Common.SCMHelper.StartService(String serviceName, Nullable`1 waitTimeout, String hostName)
--- End of inner exception stack trace ---
at Microsoft.ServiceBus.Commands.Common.SCMHelper.StartService(String serviceName, Nullable`1 waitTimeout, String hostName)
at Microsoft.ServiceBus.Commands.ServiceBusConfigHelper.StartSBServices(String hostName, Nullable`1 waitTimeout)
at Microsoft.ServiceBus.Commands.AddSBHost.ProcessRecordImplementation()
--- End of inner exception stack trace ---
at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
at Microsoft.ServiceBus.ConfigWizard.CommandletHelper.InvokePowershell(Command command, Action`3 updateProgress)
at Microsoft.ServiceBus.ConfigWizard.ProgressPageViewModel.AddSBNode(FarmCreationModel model, Boolean isFirstCommand)
EDIT :
Using a different account and different port numbers (the default didn't work) I have managed to configure the SB, but now for some reason it still tries to use the default ports...
Does this thing work on ports other than the default ones?
If you are logged in as a domain user you need contact with the domain controller. This is what is failing for you.
I got this same error when trying to install service bus on my work laptop at home. When back at the office the installation was successful.
Some additional information about system requirements here: https://msdn.microsoft.com/en-us/library/dn441409.aspx
I have a situation where I can't host a service using net.tcp under windows 7 but it works fine on windows 2008 server. I have enabled WAS, and made the same settings in both windows 7 and windows server but for some reason it doesn't work in windows 7. The error I get on the client side is:
System.ServiceModel.EndpointNotFoundException: The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost:908/TcpTest/MySuperService.svc' is unavailable for the protocol of the address.
Server stack trace:
at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
And in the event log I got the following error for the service:
An error occurred while trying to listen for the URL '/LM/W3SVC/9/ROOT/TcpTest'. This worker process will be terminated.
Sender Information: net.tcp
Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/24230272
Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .
at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register()
at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting)
at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting)
at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token)
at System.ServiceModel.Activation.HostedTcpTransportManager.Start(Int32 queueId, Guid token, Action messageReceivedCallback)
at System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler.OnStart()
at System.ServiceModel.WasHosting.BaseAppDomainProtocolHandler.StartListenerChannel(IListenerChannelCallback listenerChannelCallback)
Process ID: w3wp
The web.config is exactly the same for the service on both windows 7 and windows 2008. Any clues?
I was having this same problem, in which the exception message ends in
... NetTcpPortSharing service: .
which gives no clue where to go from there.
It turned out that the Net.Tcp Listener Adapter service was pointing to .NET 3 and the Net.TCP Port Sharing Service was pointing to .NET 4
I was able to quickly fix it by running
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\ServiceModelReg.exe -r
I guess you've already solved it since...
Was it the case with portsharing was not enabled ?
http://msdn.microsoft.com/en-us/library/aa395195.aspx
It seems like it is working. I have a new computer now and tried it again with not problem at all. So it should work just fine to host net.tcp on Win 7 with IIS7.