HaspDotNetDllBroken error - asp.net

I am using Safenet Sentinel key, I have created a webservice for login but when i run it the first time it throws an error HASPDotNetDllBroken but runs fine if i run it the second time or consecutively after that.
I am using the following dlls:
apidsp_windows.dll
hasp_net_windows.dll
and my webservice is:
[WebMethod]
public string Log()
{
HaspFeature feature = HaspFeature.Default;
string vendorCode="Az........";
Hasp hasp = new Hasp(feature);
HaspStatus status = hasp.Login(vendorCode);
if (HaspStatus.StatusOk != status)
{
return("Login Failed with status "+status.ToString());
}
else
{
return ("Login Successful with status "+status.ToString());
}
}

From the dll's you mention it seems your webservice is 32-bit. In that case you have to put the apidsp_windows.dll and the hasp_windows_.dll in the System32 directory on 32-bit machines and in the SysWOW64 directory on 64-bit machines. is your numeric vendorid, or demo if you're running in evaluation mode.
I hope that helps.

Related

"sbt server is already booting." error when launching sbt from wsl2 ubuntu

I've installed sbt using sdkman on wsl2 ubuntu setup. Currently sbt 1.4.2 is installed. When I try to launch it from the terminal it gives
sbt server is already booting. Create a new server? y/n (default y) if I choose n, nothing happens. If I choose y, then sbt starts. What I want to do is to be able to start sbt without that error message. Because this behaviour breaks metals on visual studio code.
I checked the sbt source code and found that the method below prints the error message - in sbt/main/src/main/scala/sbt/Main.scala
private def getSocketOrExit(
configuration: xsbti.AppConfiguration
): (Option[BootServerSocket], Option[Exit]) =
try (Some(new BootServerSocket(configuration)) -> None)
catch {
case _: ServerAlreadyBootingException
if System.console != null && !ITerminal.startedByRemoteClient =>
println("sbt server is already booting. Create a new server? y/n (default y)")
val exit = ITerminal.get.withRawInput(System.in.read) match {
case 110 => Some(Exit(1))
case _ => None
}
(None, exit)
case _: ServerAlreadyBootingException =>
if (SysProp.forceServerStart) (None, None)
else (None, Some(Exit(2)))
}
}
So, calling new BootServerSocket(configuration) throws an exception. Exception source is the method below from BootServerSocket.java;
static ServerSocket newSocket(final String sock) throws ServerAlreadyBootingException {
ServerSocket socket = null;
String name = socketName(sock);
try {
if (!isWindows) Files.deleteIfExists(Paths.get(sock));
socket =
isWindows
? new Win32NamedPipeServerSocket(name, false, Win32SecurityLevel.OWNER_DACL)
: new UnixDomainServerSocket(name);
return socket;
} catch (final IOException e) {
throw new ServerAlreadyBootingException();
}
}
I checked the isWindows method and it returns false. So the new UnixDomainServerSocket(name) part is running. And somehow it can't create a unix domain server socket. That's all I found out. Is there a way to fix this? Or is this a bug?
After moving my project files to a directory within wsl2, problem is solved. My project files were in a Windows directory before.

.NET Core Error 1053 the service did not respond to the start or control request in a timely fashion

I created a Windows Service starting from my .NET Core project following this
After this, I installed correctly it on my working machine and started it.
This is my service class:
using System;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading.Tasks;
namespace xxx
{
public class WindowsService
{
static void Main(string[] args)
{
System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);
using (var service = new Service())
{
ServiceBase.Run(service);
}
}
}
internal class Service : ServiceBase
{
public Service()
{
ServiceName = "...";
}
protected override void OnStart(string[] args)
{
try
{
base.OnStart(args);
Task.Run(() => xxxx);
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
}
}
protected override void OnStop()
{
base.OnStop();
}
protected override void OnPause()
{
base.OnPause();
}
}
}
So, I copied the file and installed it also on a server. Here, when I try to start it, I get:
After this, I start a lot of googling... for example, I tried the following steps :
Go to Start > Run > and type regedit
Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
With the control folder selected, right click in the pane on the right and - select new DWORD Value
Name the new DWORD: ServicesPipeTimeout
Right-click ServicesPipeTimeout, and then click Modify
Click Decimal, type '180000', and then click OK
Restart the computer
The weird point here is that the voice ServicesPipeTimeout didn't exist and I created it. Comparing the server with my working machine, there are also other value not present in the server. They are:
ServicesPipeTimeout
OsBootstatPath
Here the screenshot of regedit from the server:
Are these relevant?
I also tried to reinstall the service, recompile my files... how can I fix this problem? The error appears immediatly, it doesn't wait any timeout!
I had this problem when I switched my project to another location.
When I moved the project, I had copied the files in bin/debug folder too. The issue was resolved after I cleared the debug folder and created a new build.
See if this works!
It's a bit old question but someone may find this useful.
So I had the following code in Program.cs:
builder.SetBasePath(Environment.CurrentDirectory).AddJsonFile("appsettings.json")
Changed it to:
builder.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).AddJsonFile("appsettings.json")
This seemed to fix the problem for me.
The problem with this error is that it is super generic.
Hopefully MS will give us some log in the future.
if you check the windows event viewer under applications it tells you what exactly is the exception that causes this error.
in my case the problem was i published the service in net6 and tried to run it on a pc with net7 installed. apparently it requires the exact major version that was used to publish the app.

MvvmCross - Windows Phone 8 + SQLite - Could not open database file

I am using MvvmCross to create Android, WPF and Windows Phone 8/8.1 apps. I've gotten SQLite working fine in the WPF and Android apps.
With the Windows Phone app, I am running into an issue when calling Create() on the SQLite database file.
The first time this is called, the create and open work just fine, but when the create() is called a second time it always fails.
Code:
ISQLiteConnection db = factory.Create("filename.sql");
db.Close();
Error:
"Could not open database file: filename.sql (CannotOpen)"
Stack:
at SQLite.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks)
at Cirrious.MvvmCross.Plugins.Sqlite.WindowsPhone.MvxWindowsPhoneSQLiteConnectionFactory.Create(String address)
at MvvmCrossPOC.Core.Services.MetadataService.OpenDatabase()
I followed this article, and others with similar steps, and added the MvvmCross SQLite Plugin (v3.5 - Install-Package MvvmCross.HotTuna.Plugin.SQLite), but the error remained.
WP8 SQLite error: The specified module could not be found
Any thoughts on how to move forward?
Code Sample:
public MetadataService(ISQLiteConnectionFactory SQLiteConnectionFactory)
{
factory = SQLiteConnectionFactory;
}
public List<Platform> GetPlatformCollection()
{
db = factory.Create(METADATA_REPO_NAME);
try
{
return db.Table<Platform>().ToList();
}
finally
{
db.Close();
}
}
Arg! Hours to figure out this was all me writing the code incorrectly.
Remember: Services are Singletons...so, you don't have to open and close the database every time you use it!
Figured that out after finding Stuart's SQLite example: KittensDB
Not sure why I didn't see this issue on any other platforms...
Working Code Sample
public MetadataService(ISQLiteConnectionFactory factory)
{
//Get the connection
db = factory.Create(METADATA_REPO_NAME);
db.CreateTable<PlatformStorage>();
db.CreateTable<DashboardStorage>();
}
public List<Platform> GetPlatformCollection()
{
return db.Table<Platform>().ToList();
}

COM Service Error: Received an unexpected EOF or 0 bytes from the transport stream

I have a .NET application that uses a 3rd party Web Service for authentication.
My code:
var sso = new com.myclient.auth.Service();
string userID = sso.DecryptUser(encryptedUserString, decryptionKey);
This has been working for quite some time. I've since been forced to convert the application from .NET 2.0 in VS 2008 to .NET 3.5 in VS 2010 and now it no longer works. I get an error at "DecryptUser": "Received an unexpected EOF or 0 bytes from the transport stream".
I don't see any changes made to this code during the conversion. I tried the much used solution for this error of forcing SecurityProtocolType.Ssl3 -- that did not work either. If I revert back to VS 2008 and build, the page works -- no error.
Okay -- I did a full file compare for the entire project, and found this change in Properties/Settings.Designer.cs that occurred during the VS conversion:
public string MyProj_com_myclient_auth_Service {
get {
string urlSetting = System.Configuration.ConfigurationSettings.AppSettings["com.myclient.auth"];
if (urlSetting != null)
{
return urlSetting.ToString();
}
else
{
return ((string)(this["MyProj_com_myclient_auth_Service"]));
}
}
}
...was changed to:
public string MyProj_com_myclient_auth_Service {
get {
return ((string)(this["MyProj_com_myclient_auth_Service"]));
}
}
I changed it back and it is working now in the new environment.

Thread aborting issue with Sharp Svn with C#.Net 4.0

I have developed ASP.net application using VS-2010, C#.Net 4.0 with SharpSvn dll. When I'm working with dev server(don't have 3-Tier Architecture), it works fine. But when we are working with QA environment(have 3-Tier Architecture) it gives thread abort exception most of the time.Following shows the code and error log I have. Any help on this really appreciate.
public bool Checkout(string svnurl, string target)
{
try
{
using (_client = new SharpSvn.SvnClient())
{
_client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true);
_client.Authentication.DefaultCredentials = new TNetworkCredential(_username, _password);
_client.Authentication.SslServerTrustHandlers += SvnSslOveride;
var targetsvn = new SvnUriTarget(svnurl);
if (_client.CheckOut(targetsvn, target))
{
Log.Info("Successfully checked out to following location : " );
Log.Info(target);
return true;
}
}
Log.Info("Unable to checkout "+ svnurl +" Svn location to target location : ");
Log.Info(target);
return false;
}
catch (Exception ee)
{
Log.Error("Error:SvnClient checkout....");
Log.Error(ee);
throw ee;
return false;
}
}
private static void SvnSslOveride(object sender, SvnSslServerTrustEventArgs e)
{
e.AcceptedFailures = e.Failures;
e.Save = true;
}
error log
ERROR 2013-08-12 12:13:37,714 3223821ms SvnClient Checkout -
Error:SvnClient checkout.... ERROR 2013-08-12 12:13:37,730 3223837ms
SvnClient Checkout - System.Threading.ThreadAbortException: Thread was
being aborted. at svn_client_checkout3(Int32* , SByte* , SByte* ,
svn_opt_revision_t* , svn_opt_revision_t* , svn_depth_t , Int32 ,
Int32 , svn_client_ctx_t* , apr_pool_t* ) at
SharpSvn.SvnClient.CheckOut(SvnUriTarget url, String path,
SvnCheckOutArgs args, SvnUpdateResult& result) at
SharpSvn.SvnClient.CheckOut(SvnUriTarget url, String path)
I missed <httpRuntime executionTimeout="(time in seconds)">
tag in web config and it automatically set by IIS server. The default is 110 seconds.
Note :In the .NET Framework 1.0 and 1.1, the default is 90 seconds.
After I added following line to web.config and it works fine.
<httpRuntime executionTimeout="600">
Previously it works sometimes because the time taken to SVN checkout in DEV server is less than in other environment because of the size of the repositories and network connections. Thanks all for your answers
As per my comment above, I've seen this issue. It appears to be related to plink authentication.
I resolved it by upgrading to the latest build of SharpSVN v1.7, at which point the error changed from a null-ref exception in the C++, to an SVN exception with the message "Can't create tunnel: The parameter is incorrect".
There are a few articles which explain how to resolve this, the best of which I've found here:
SVN+SSH and Sourceforge
In my case, changing the backslashes to forwardslashes in the SVN_SSH env var resolved the problem. Worth giving a shot.

Resources