NHibernate profiler doesnt fetch my sessions - nhibernate

I've just downloaded nhibernate profiler and I cannot figure why it is not working.
As far as I know, it should be enough to set Connection string inside Options - Edit default connection.
I'm using sql server and I've copied my connection string like this
Data Source=.\SQLEXPRESS;Initial Catalog=DB_xxx_MyDb;Integrated Security=True;
In debug mode of my app I have nothing inside nhibernate profiler when executing my app.
Update:
Added reference to my mvc3 project
HibernatingRhinos.Profiler.Appender.v4.0.dll
Global.asax
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
#if DEBUG
HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
#endif
}
I made following steps
start NhProf.exe
start debugging mvc app, these app queries I want to profile
Nothing appears in Nhibernate profiler. Licence is working for 32 days.
Why? What else should I do?
Second update:
I tried with reference HibernatingRhinos.Profiler.Appender.dll still no working.
Tried with options-settings-listen port to set my asp dev. server port, right now is 5442.
Still nothing. I'm bit confused.
Just to mention that my app works, my connection string works, I am able to fetch data from my db, ...
My log.txt file inside NHProfiler folder have this content
2012-03-28 20:31:01,374 [1] INFO Rhino.Licensing.LicenseValidator [(null)] - License expiration date is 04/29/2012 00:00:00
2012-03-28 20:31:01,662 [1] DEBUG Rhino.Licensing.LicenseValidator [(null)] - License accepted for NHibernate Profiler
2012-03-28 20:31:02,461 [6] INFO HibernatingRhinos.Profiler.Client.App [(null)] - Checking for updates...
2012-03-28 20:31:25,072 [4] ERROR HibernatingRhinos.Profiler.Client.App [(null)] - Error while checking for updates: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 216.121.112.229:80
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at NAppUpdate.Framework.Sources.SimpleWebSource.GetUpdatesFeed()
at NAppUpdate.Framework.UpdateManager.CheckForUpdates(IUpdateSource source, Action`1 callback)
at NAppUpdate.Framework.UpdateManager.<>c__DisplayClass2.<CheckForUpdateAsync>b__1()

Have you initialized the NHibernateProfiler in your app/websites?
Something like this in the Applicattion_Start() or Main()
#if DEBUG
HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
#endif
Also remember to reference the dll
HibernatingRhinos.Profiler.Appender.v4.0.dll

After returning default listening port inside options-settings everything works. Finally. Thanks #Iridio.
Btw if anyone needs to conclude:
Step 1: Add reference
Step 2: Inside Global.asax Application_Start() add these line
#if DEBUG
HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
#endif
Step 3: Start NhProf, inside Options-Connection string add your conn.string.
Step 4: Run your app.
The default listening port is 22897. Do not change this.

Related

RavenDB Unable to boot server on local machine

i keep having the same problem for a few weeks now and i can't seem to figure out what it is.
I recently stared using RavenDB and it was working fine, but after a few days when i come home and want to boot the server on my local machine it just does not want to boot, it gives the following stack trace in the logs:
2019-03-05T18:58:43.0323063Z, 1, Operations, Server, Raven.Server.RavenServer, Failed to create a webhost to redirect HTTP traffic to HTTPS, EXCEPTION: System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass22_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func`2 createBinding)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
at Raven.Server.RavenServer.RedirectsHttpTrafficToHttps() in C:\Builds\RavenDB-Stable-4.1\41010\src\Raven.Server\RavenServer.cs:line 312
Now i am not very familiar with networking but i have no clue why initially it works for a few days and then it just stops working.
Any help would be greatly appreciated.
The most likely reason is that there is something that is already using the port that RavenDB is trying to bind into.
Check things like Get-NetTCPConnection output or netstat to verify that

Microsoft Service Bus 1.1 configuration wizard fails - The LDAP server is unavailable

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

RavenDB Replication Issue - database cannot be found

Have followed the documentation, but am unable to make replication work for RavenDB over the WAN.
Scenario:
Using Raven build #2261
Master DB: has a local name of "it23"
Slave DB: has a remote name of "http://184.169.xxx.xxx" (xxx's are for
privacy)
On both servers I have created a database called "TonyTest".
On the Master db, I have set up replication using the following document:
{
"Destinations": [
{
"Url": "http://184.169.xxx.xxx:8080",
"Username": null,
"Password": null,
"Domain": null,
"ApiKey": null,
"Database": "TonyTest",
"TransitiveReplicationBehavior": "None",
"IgnoredClient": false,
"Disabled": false,
"ClientVisibleUrl": null
}
]
}
When browsing to the remote server using the same URL of: http://184.169.xxx.xxx:8080, the RavenDB studio launches correctly, and I can see the TestTony database. This seems to confirm that the URL is formatted correctly.
However, the master database immediately generates a document showing failures:
{
"Destination": "http://184.169.xxx.xxx:8080/databases/TonyTest",
"FailureCount": 142
}
When we look at the logs for the REMOTE db, we see that there IS communication with the master, but the replication doesn't complete.
Debug 3/9/2013 12:19:44 AM Document with key 'Raven/Replication/Sources/http://it23:8080/databases/TonyTest' was not found Raven.Storage.Esent.StorageActions.DocumentStorageActions
It looks like the remote server is saying that the db "TonyTest' can't be found, but it IS created.
Can anyone spot my mistake?
Per Ayende's request, here are some log samples from LOCAL server after attempting to setup replication (again I replaced IPs with xxx for privacy). We do not see any errors in the LOCAL db's log. And we do see errors popup in the REMOTE db log. This seems to imply that the LOCAL db is connecting to the REMOTE db, but the replication does not happen. Here are the LOCAL logs:
Debug 3/11/2013 3:17:00 PM No work was found, workerWorkCounter: 17626, for: ReducingExecuter, will wait for additional work Raven.Database.Indexing.WorkContext
Debug 3/11/2013 3:17:00 PM Going to index 1 documents in IndexName: Raven/DocumentsByEntityName, LastIndexedEtag: 00000001-0000-0100-0000-000000002265: (Raven/Replication/Destinations/184.169.xxx.xxx8080databasesTonyTest) Raven.Database.Indexing.AbstractIndexingExecuter
Debug 3/11/2013 3:17:00 PM Document with key 'Raven/Studio/PriorityColumns' was not found Raven.Storage.Esent.StorageActions.DocumentStorageActions
Debug 3/11/2013 3:16:56 PM Going to index 1 documents in IndexName: Raven/DocumentsByEntityName, LastIndexedEtag: 00000001-0000-0100-0000-000000002256: (Raven/Replication/Destinations/184.169.xxx.xxx8080databasesTonyTest) Raven.Database.Indexing.AbstractIndexingExecuter
Update 3/11 8:24p Pacific time
I am now seeing the following errors in the MASTER/Local raven logs:
Failed to close response
System.AggregateException: One or more errors occurred. ---> System.Net.HttpListenerException: An operation was attempted on a nonexistent network connection
at System.Net.HttpResponseStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at Raven.Database.Util.Streams.BufferPoolStream.Dispose(Boolean disposing) in c:\Builds\RavenDB-Stable\Raven.Database\Util\Streams\BufferPoolStream.cs:line 144
at System.IO.Stream.Close()
at Raven.Database.Impl.ExceptionAggregator.Execute(Action action) in c:\Builds\RavenDB-Stable\Raven.Database\Impl\ExceptionAggregator.cs:line 23
--- End of inner exception stack trace ---
at Raven.Database.Impl.ExceptionAggregator.ThrowIfNeeded() in c:\Builds\RavenDB-Stable\Raven.Database\Impl\ExceptionAggregator.cs:line 38
at Raven.Database.Server.Abstractions.HttpListenerResponseAdapter.Close() in c:\Builds\RavenDB-Stable\Raven.Database\Server\Abstractions\HttpListenerResponseAdapter.cs:line 94
at Raven.Database.Server.Abstractions.HttpListenerContextAdpater.FinalizeResponse() in c:\Builds\RavenDB-Stable\Raven.Database\Server\Abstractions\HttpListenerContextAdpater.cs:line 92
---> (Inner Exception #0) System.Net.HttpListenerException (0x80004005): An operation was attempted on a nonexistent network connection
at System.Net.HttpResponseStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at Raven.Database.Util.Streams.BufferPoolStream.Dispose(Boolean disposing) in c:\Builds\RavenDB-Stable\Raven.Database\Util\Streams\BufferPoolStream.cs:line 144
at System.IO.Stream.Close()
at Raven.Database.Impl.ExceptionAggregator.Execute(Action action) in c:\Builds\RavenDB-Stable\Raven.Database\Impl\ExceptionAggregator.cs:line 23<---
Solved this. Although I don't understand the full reason why.
On the SLAVE server, you must set the raven.server.exe config file to have the following key:
<add key="Raven/AnonymousAccess" value="All"/>
The default was
<add key="Raven/AnonymousAccess" value="Get"/>.
The default worked fine when the master and slave were on the same machine. But when the master and slave were on separate machines (either on the LAN, or across the WAN) replication failed.
I could never find a log entry on the master that pointed toward his problem. The only log entry I could see was on the slave which said that Raven/Replication/Sources/ was not found. I realized that the master was connecting to the slave, but the slave was unable to create the "Raven/Replication/Sources/" document remotely.

Is there any difference in hosting net.tcp wcf services under Windows 7 and Windows 2008 Server in IIS?

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.

WCF Session problem

I'm new to WCF and have not much idea. By using a sample code I tried WCF through remoting...
It works fine for few min but if i leave the client without accessing the WCF server I get an exception like this....
Exception:Unable to connect to the remote server.
Inner Exception :
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 122.165.27.38:80
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
Stack Trace :
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at TeleMailer.TeleMailer.cbxtmuname_SelectedIndexChanged(Object sender, EventArgs e)
Source :
System
Exception :Server was unable to process request. ---> The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Inner Exception :
Stack Trace :
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at TeleMailer.Server.Service.get_path()
at TeleMailer.TeleMailer.TeleMailer_Load(Object sender, EventArgs e)
Source :
System.Web.Services
But it's not in faulted state nor it's closed!!!
Actually in my application the client communicates to the server which in turn contacts the WCF and gives him the work to do....
Right now I'm using Cassini as my server. It works great for few min but after nearly ten min it just shows this error message.... but if i restart my Cassini it works properly for few min again and gets the problem....
I cant understand how it goes to faulted state when it's able to connect more clients....
is it because the session has timed out or what? and if session has timed out then from which side from my server or client???
Any Idea plz..........
I've been siting with it for whole day but could not trace out any thing!!!
It may be a timeout problem, related to when you create the wcf proxy object in your client code.
It looks like you create the proxy object when you start the client and then just reuse it. This object maintains a connection to the server, which timesout after 10 min.
A better way to do it would be to create a new proxy object with a using statement, each time you need it.
" if i leave the client without accessing the WCF server I get an exception like "
May be due to inactivityTimeout, so you can increase it, or dispose your client object as soon as possible (try using statement)
you can set the property as follows
<reliableSession ordered="true" inactivityTimeout="00:00:05"
enabled="false" />