I've just got an error report from a client using a program I wrote, and I've been googling the nuts off of this error and can't find anything useful. The error is:
System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception: at System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, System.String where)
at System.Net.WebConnection.ReadDone(IAsyncResult result)
at System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
at System.Net.WebClient.DownloadFileCore (System.Uri address, System.String fileName, System.Object userToken) [0x00000] in <filename unknown>:0
at System.Net.WebClient.<DownloadFileAsync>m__F (System.Object state) [0x00000] in <filename unknown>:0
System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception: at System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, System.String where)
at System.Net.WebConnection.ReadDone(IAsyncResult result)
at System.Net.WebConnection.HandleError (WebExceptionStatus st, System.Exception e, System.String where) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
at System.Net.WebClient.DownloadFileCore (System.Uri address, System.String fileName, System.Object userToken) [0x00000] in <filename unknown>:0
at System.Net.WebClient.<DownloadFileAsync>m__F (System.Object state) [0x00000] in <filename unknown>:0
The application is the launcher program for a game, it pulls down a manifest of files and patches any which are non-existent or outdated. All the files it downloads with a WebClient object, it looks like the error is being thrown by WebClient::DownloadFileAsync, but I can't find any documentation as to why this could be happening.
Any help would be much appreciated, the quicker I can fix this monday morning the better!
Cheers
Joe
Does the client uses a proxy?
If yes, are you attaching the proxy to the WebClient object?
Your error simply mentions that the file could not be found, DownloadFileAsync needs a file stream, and if that's not there, you get an error...
Any thoughts in implementing a log system that can be activate through a parameter that would POST the log file into your FTP for example?
You could make use of several open source projects out there, like ExceptionReporter.
After the sysadmin played with the server config a bit this problem seemed to go away, I'm not sure exactly what was done though.
Related
I have a C# app written for pushing some data to MS service (PowerBI) using ADAL for authentication. I have created and compiled it using Mono on Debian Jessie (trying to get as close to production environment as possible). It runs perfectly on this machine but when I move it to production I get an error Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: user_realm_discovery_failed: User realm discovery failed. I have read it might be connected to defaultProxy setting in machine.config so I modified my code accordingly but it didn't help. Main differences between production server and my machine are:
Command line only (prod) -> GNOME, Static IP -> Dynamic IP. Both are virtual machines. The full error output:
Unhandled Exception:
Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: user_realm_discovery_failed: User realm discovery failed ---> System.Net.WebException: Error getting response stream (Write: failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext context, AlertDescription description) [0x00000] in <filename unk
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpWebRequestWrapper+<GetResponseSyncOrAsync>d__2.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.IHttpWebResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenNonInteractiveHandler+<PreTokenRequest>d__4.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase+<RunAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenCommonAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
ErrorCode: user_realm_discovery_failed
StatusCode: 0
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: user_realm_discovery_failed: User realm discovery failed ---> System.Net.WebException: Erhe authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certifica0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext context, AlertDescription description) [0x00000] in <filename unk
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpWebRequestWrapper+<GetResponseSyncOrAsync>d__2.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.IHttpWebResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenNonInteractiveHandler+<PreTokenRequest>d__4.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase+<RunAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenCommonAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
ErrorCode: user_realm_discovery_failed
StatusCode: 0
All the references to <filename unknown>:0 are not helpful either.
EDIT: I have also tried compiling it on the production machine - same error when trying to run
I have figured it out myself, quite stupid mistake. I installed mono from default debian repos and they were outdated. I have actually thought about it and added xamarin up-to-date repos, but I didn't notice that on apt-get upgrade the mono packages got kept back. apt-get distro-upgrade fixed it all. Just have to be careful with this command - can mess up your system.
I have a very strange problem.
We implemented a Soap API to talk to a third party. The API sort of works. There is an IsAlive method which checks if the third party service is alive.
Our application is hosted on an Ubuntu 14.04 server under Apache with Mod-Mono (Mono).
We call this API when we load a particular page. It works up to a point then we get an error. I.E. You can make a request to the IsAlive xxx (It's random) amount of times and it works, then next time you try and do it the following exception gets thrown:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: buffer underrun
at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: buffer underrun
at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream+<SetHeadersAsync>c__AnonStorey1.<>m__0 (IAsyncResult r) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at ASP.somepage_aspx.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
Mono.Security.Protocol.Tls.TlsException: buffer underrun
at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
The API at this point does not work anymore. Even if we refresh the page and make another call. We try to re-request 2-3 times then we get another error.
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at ASP.somepage_aspx.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
The only way to make the API work again is if we restart the Ubuntu Server.
Here is a snippet of how we send the request.
public string TestSiteStatus()
{
getSiteStatus site = new getSiteStatus();
site.site = "XXX";
string res = "";
using (SiteServiceImplService service = new SiteServiceImplService())
{
res = service.getSiteStatus(site);
}
return res;
}
Does anyone know what is wrong here? Is there a problem with my implementation or is this a Mono framework issue?
I have tried the instructions on this page: http://www.mono-project.com/docs/faq/security/ but no success. When I run thetest, it passes the first and sometimes the second time but fails after that.
Turns out there was a certificate issue with our third party. They updated their certificates, we added them to our stores, and it worked.
Our the API SSL cert was vulnerable to a LogJam attack. The ciphering of the certificate caused problems with our server.
This link helped us test and find the problem.
I'm trying to install Xamarin on my MacBook Pro 2011 running 10.7.4.
When I run the installer it attempts to install the Android SDK first, however after a while it fails and the error report states:
Error downloading from Google server. Android SDK.
The operation has timed out.
Exception type: System.Net.WebException
Message: The operation has timed out.
at System.Net.WebConnectionStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.DownloadService.DoDownload (Int64 totalBytes, System.IO.Stream responseStream, System.IO.Stream outputStream, System.Object state) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Utilities.DownloadUrl (System.Net.HttpWebResponse response, System.String url, System.Action`4 doDownload, Boolean noCache, System.Object state) [0x00000] in <filename unknown>:0
Android SDK installation failed with more than one exception (Attempt #Android SDK)
Some installation errors are present.
Exception type: System.AggregateException
Message: Some installation errors are present.
Exception type: Xamarin.Web.Installer.InstallException
Message: Download failed.
at Xamarin.Web.Installer.Installer.BaseSoftwareItem.ValidateDownloadItem () [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.Install (UInt32 tryNumber) [0x00000] in <filename unknown>:0
at MacInstaller.WizardPageInstallationController.InstallationWorker () [0x00000] in <filename unknown>:0
Exception type: System.Net.WebException
Message: The operation has timed out.
at System.Net.WebConnectionStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.DownloadService.DoDownload (Int64 totalBytes, System.IO.Stream responseStream, System.IO.Stream outputStream, System.Object state) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Utilities.DownloadUrl (System.Net.HttpWebResponse response, System.String url, System.Action`4 doDownload, Boolean noCache, System.Object state) [0x00000] in <filename unknown>:0
Exception type: Xamarin.Web.Installer.InstallException
Message: Download failed.
at Xamarin.Web.Installer.Installer.BaseSoftwareItem.ValidateDownloadItem () [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.Install (UInt32 tryNumber) [0x00000] in <filename unknown>:0
at MacInstaller.WizardPageInstallationController.InstallationWorker () [0x00000] in <filename unknown>:0
Exception type: System.Net.WebException
Message: The operation has timed out.
at System.Net.WebConnectionStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.DownloadService.DoDownload (Int64 totalBytes, System.IO.Stream responseStream, System.IO.Stream outputStream, System.Object state) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Utilities.DownloadUrl (System.Net.HttpWebResponse response, System.String url, System.Action`4 doDownload, Boolean noCache, System.Object state) [0x00000] in <filename unknown>:0
Exception type: Xamarin.Web.Installer.InstallException
Message: Download failed.
at Xamarin.Web.Installer.Installer.BaseSoftwareItem.ValidateDownloadItem () [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Installer.AndroidSoftwareItem.Install (UInt32 tryNumber) [0x00000] in <filename unknown>:0
at MacInstaller.WizardPageInstallationController.InstallationWorker () [0x00000] in <filename unknown>:0
Exception type: System.Net.WebException
Message: The operation has timed out.
at System.Net.WebConnectionStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.DownloadService.DoDownload (Int64 totalBytes, System.IO.Stream responseStream, System.IO.Stream outputStream, System.Object state) [0x00000] in <filename unknown>:0
at Xamarin.Web.Installer.Utilities.DownloadUrl (System.Net.HttpWebResponse response, System.String url, System.Action`4 doDownload, Boolean noCache, System.Object state) [0x00000] in <filename unknown>:0
What's wrong?
I have a .Net based command line app that interacts (CRUD) with PostgreSQL 9.1. Using Nuget, the project currently references NHibernate 3.2.0.4000 and FluentHibenrate 1.3.0.717
Now the code runs fine under .Net environment (meaning Windows Xp/7), but under Mono (Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)), I am seeing TypeLoadException within NHibernate from the exact same code (I did not re-compile anything for mono.). Can someone help and point the way? Thanks!
Here is the stack trace
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> NHibernate.MappingException: Could not compile the mapping document: (XmlDocument) ---> System.TypeInitializationException: An exception was thrown by the type initializer for NHibernate.Dialect.Dialect ---> System.TypeLoadException: Could not load type 'NHibernate.Dialect.Dialect+NoOpViolatedConstraintNameExtracter' from assembly 'NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.AddDeserializedMapping (NHibernate.Cfg.MappingSchema.HbmMapping mappingDocument, System.String documentFileName) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.LogAndThrow (System.Exception exception) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddDeserializedMapping (NHibernate.Cfg.MappingSchema.HbmMapping mappingDocument, System.String documentFileName) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.ProcessMappingsQueue () [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddDocumentThroughQueue (NHibernate.Cfg.NamedXmlDocument document) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddXmlReader (System.Xml.XmlReader hbmReader, System.String name) [0x00000] in <filename unknown>:0
at NHibernate.Cfg.Configuration.AddInputStream (System.IO.Stream xmlInputStream, System.String name) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration () [0x00000] in <filename unknown>:0
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory () [0x00000] in <filename unknown>:0
at MyProj.Repository.FluentNHibernateHelperPostgreSQL.CreateSessionFactory () [0x00000] in <filename unknown>:0
at MyProj.Repository.FluentNHibernateHelperPostgreSQL.get_SessionFactory () [0x00000] in <filename unknown>:0
at MyProj.Repository.FluentNHibernateHelperPostgreSQL.OpenSession () [0x00000] in <filename unknown>:0
at MyProj.Repository.NHibernateSessionHelper.SmartSessionFactory () [0x00000] in <filename unknown>:0
at MyProj.Repository.NHibernateSessionHelper.DoAnything (MyProj.Repository.TargetMethod target) [0x00000] in <filename unknown>:0
at MyProj.Program+<>c__DisplayClass10.<RetrieveDataDriver>b__a () [0x00000] in <filename unknown>:0
Here is the relevant code for FluentNHibernateHelperPostgreSQL.CreateSessionFactory ()
private static ISessionFactory CreateSessionFactory()
{
FluentConfiguration fluentConfiguration = Fluently.Configure();
PostgreSQLConfiguration standard = PostgreSQLConfiguration.Standard;
FluentConfiguration fluentConfiguration1 = fluentConfiguration.Database(((PersistenceConfiguration<PostgreSQLConfiguration, PostgreSQLConnectionStringBuilder>)standard).ConnectionString((PostgreSQLConnectionStringBuilder c) => c.FromConnectionStringWithKey("ConnectionStringKey")));
ISessionFactory sessionFactory = fluentConfiguration1.Mappings((MappingConfiguration m) => m.AutoMappings.Add(FluentNHibernateHelperPostgreSQL.CreateAutomappings)).ExposeConfiguration(FluentNHibernateHelperPostgreSQL.BuildSchema).BuildSessionFactory();
return sessionFactory;
}
The solution was to manually deploy the latest Mono package from go-mono.com
As suggested by knocte in the comment section, 2.11.4 solved the problem.
I haven't tried 3.x, but so far, I have been happy 2.11.x with no reason to jump into 3.x ship yet.
why i get this error
Unhandled Exception: Twitterizer.TwitterizerException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Twitterizer.WebRequestBuilder.ExecuteRequest () [0x00000] in <filename unknown>:0
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
at terminal_twitt.Program.Main (System.String[] args) [0x00000] in /home/julio/Projects/terminal-twitt/terminal-twitt/Program.cs:18
[ERROR] FATAL UNHANDLED EXCEPTION: Twitterizer.TwitterizerException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Twitterizer.WebRequestBuilder.ExecuteRequest () [0x00000] in <filename unknown>:0
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Twitterizer.OAuthUtility.GetRequestToken (System.String consumerKey, System.String consumerSecret, System.String callbackAddress) [0x00000] in <filename unknown>:0
at terminal_twitt.Program.Main (System.String[] args) [0x00000] in /home/julio/Projects/terminal-twitt/terminal-twitt/Program.cs:18
The application was terminated by a signal: SIGHUP
i use twitterizer and mono 2.6 for linux with .NET 4.0 runtime in it. i have tried this code with visual studio in my windows, and worked perfectly. but when i tried to build it with mono i get this error.
here is my code:
static void Main(string[] args)
{
string requestToken = OAuthUtility.GetRequestToken("my consumer key", "my consumer secret", "oob").Token;
}
I had the same problems so simply talking i choose to import all certificates using
mozroots --import --ask-remove
and now I can login with twitter
See the Mono project wiki:
FAQ Security on SSL/TLS; and
Using Trusted Roots Respectfully article
They will show you how to add the missing x.509 certificates on your system (users) and how to best deal with such situations inside your own application (developers).
Works for setup of kvm with mono and vNext too - otherwise you can't do
kpm restore -s https://www.myget.org/F/aspnetvnext/
Many thanks for the tip!
From mono's documentation:
Note that if you are using a web application (i.e. not the current user) you must add the --machine option like this:
mozroots --import --ask-remove --machine
*you might want to run this with sudo