NMath IIS access denied - asp.net

I have tried using the NMath library on a
ASP.NET 4 web application hosted in IIS. While it works perfectly o the development machine, on the server it throws this exception:
Unable to load DLL 'nmath_native_x86.dll': Access is denied.
(Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.DllNotFoundException: Unable to load DLL
'nmath_native_x86.dll': Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[DllNotFoundException: Unable to load DLL 'nmath_native_x86.dll':
Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))]
CenterSpace.NMath.Kernel.DotNetBlas.ca985db1fb290841a533a3547ace1ae2b(Int32*
ca9e3f1c0641beace93cb8eb4a27060d6, Double*
cf339080161dff75cfd1b46a10c2eec70, Int32*
c757a2154665e6da4d820f8c504ec2601, Double*
c00a69c4fa5b6d809b68a96ca184dcf79, Int32*
c1565590bf448d2c630952a0391360cc3) +0
CenterSpace.NMath.Kernel.DotNetBlas.copy(Int32 n, DoubleDataBlock x,
Int32 xOffset, Int32 incx, DoubleDataBlock y, Int32 yOffset, Int32
incy) +149 CenterSpace.NMath.Core.DoubleVector.set_Item(Slice
slice, DoubleVector value) +165
While i have read around here that it might be related the the
permissions of the AppPool or something similar, I can't seem to point down the problem. What could it be?!

It could be a couple of options.
1) Is the C++ runtime installed? NMath can't load a native dll without it. See the deployment section here: http://centerspace.net/doc/NMath/user/overview-83427.htm#Xoverview-83427
2) Perhaps you're not configuring NMath correctly? You can do NMathConfiguration.NativeLocation to point to a location. More here:
http://centerspace.net/doc/NMathSuite/ref/html/T_CenterSpace_NMath_Core_NMathConfiguration.htm
Finally, please generate log file using NMathConfiguration.LogLocation. The resulting log file will tell you what's wrong.
Trevor

Related

Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0"

I found this error after publishing the site on the server.
I tried a lot to solve this problem from my side but nothing works for me.
I have tried to update all those packages with the latest and still does not work for me.
But, it works well when I run a project in Visual Studio without any problems.
I have checked these 2 links to fix my problem but it still doesn't work for me.
Specified Web Pages version “3.0.0.0” could not be found. Update your web.config to specify a different version. Current version: “2.0.0.0”
Update your web.config to specify a different version?
However, I tried to install the downgraded (older) version and I got a 404 error code, the resource could not be found.
Also, I have checked all the web config files where the version has been declared and it seems right for me.
I don't know what I should do with this error message.
It would be nice if someone could help me with this.
Server Error in '/' Application.
Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0".
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0".]
System.Web.WebPages.Deployment.PreApplicationStartCode.StartCore(IFileSystem fileSystem, String appDomainAppPath, String binDirectory, NameValueCollection appSettings, IEnumerable1 loadedAssemblies, IBuildManager buildManager, Action1 loadWebPages, Action registerForChangeNotification, Func`2 getAssemblyNameThunk) +21268
System.Web.WebPages.Deployment.PreApplicationStartCode.StartCore() +245
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0"..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +890
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +167
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +133
System.Web.Compilation.BuildManager.ExecutePreAppStart() +178
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +746
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0"..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +737
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4261.0

System.Runtime.InteropServices.COMException: 'The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))'

I am working with zkemkeeper 64 bit. I am having an error When i ccall
bool a = axCZKEM1.Connect_Net(IPAddress, Port);
axCZKEM1 is my zkemkeeper.CZKEMClass object.
The following error i am getting.
System.Runtime.InteropServices.COMException: 'The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))'
Can you please help me with this ?
It is because COM dll files are not registered. you must have something like install.bat, run it in admin mode. Or find the Dll files from the download SDK folder, register all of them, then run the application. Problem will be resolved.

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at

I am getting following error when running the application.
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
at System.Data.SQLite.SQLite3.StaticIsInitialized()
at System.Data.SQLite.SQLiteLog.Initialize()
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
at ReserveOutlookIntegration.TririgaComm..cctor() in C:\dev\iss-outlook-plugin\AddIn2010\TririgaComm.cs:line 85
--- End of inner exception stack trace ---
at ReserveOutlookIntegration.TririgaComm.getInstance() in C:\dev\iss-outlook-plugin\AddIn2010\TririgaComm.cs:line 96
at OutlookPropertyPage.TriOptionPage..ctor(PlugInProperties properties) in C:\dev\iss-outlook-plugin\AddIn2010\OutlookOptionPage\TriOptionPage.cs:line 43
at ReserveOutlookIntegration.ThisAddIn.Application_OptionsPagesAdd(PropertyPages Pages) in C:\dev\iss-outlook-plugin\AddIn2010\ThisAddIn.cs:line 106
We have Outlook plugin developed for Room reservation manager.
The previous versions of plugin was working perfectly alright in Windows 7. Currently the same versions stopped working in Windows 10 and we have .NET framework version above 4.0 in the all systems.
The SQLite versions in my development environment is 1.0.109.0.
Kindly suggest. I am lost.

MSDeploy build after win upgrade

I am doing a msdeploy in the Developer Command Prompt (Admin) and after updating to Win 8.1 Pro, I get this error after running the command.
I did not get this error before the update I got another error USER NOT ADMIN to fix this I had to upgrade so I could create a group and add deploy as Admin.
Please forgive any bad formatting first timer.
>..\..\lib\msdeploy\msdeploy -verb:sync -source:package='Package.zip' -dest:contentPath='test.dev',computerName=localhost,userName=deploy,password=xxxx
Error: Exception has been thrown by the target of an invocation. ---> System.Exception: The type initializer for 'Microsoft.Web.Deployment.DeploymentManager' threw an exception. ---> System.Exception: The type initializer for 'Microsoft.Web.Deployment.BuiltInTypesCache' threw an exception. ---> System.Exception: The type initializer for 'Microsoft.Data.Tools.Schema.MsDeploy.MsDeployProviderBaseProviderFactory' threw an exception. ---> System.IO.IOException: Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Schema.Sql.dll' or one of its dependencies. Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Exception:Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
I believe this part of the error indicates you need to install, repair or uninstall/reinstall the 2012 version of the SQL Server Data Tools:
System.IO.IOException: Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Schema.Sql.dll' or one of its dependencies.

ActivationManager Exception during build process?

I'm getting the following exception when building a website project in VS 2010:
The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..
How do I go about debugging this? It's happening when I build in VS.NET and from the command-line (e.g., via NAnt/MSBuild).
To solve this, you need to supply the -errorstack argument to the aspnetcompiler. Then when it fails, you'll get not only the stack trace of the exception you're seeing now, but also the InnerException that it's wrapping. For instance, here's the output when the build error is caused by a problem with a Cassette dll not being loaded:
error ASPRUNTIME: The pre-application start initialization method Run on type We
bActivator.ActivationManager threw an exception with the following error message
: Exception has been thrown by the target of an invocation..
[TypeLoadException]: Could not load type 'Cassette.Configuration.ICassetteConfig
uration' from assembly 'Cassette, Version=0.8.1.0, Culture=neutral, PublicKeyTok
en=null'.
at Cassette.Web.StartUp..cctor()
[TypeInitializationException]: The type initializer for 'Cassette.Web.StartUp' t
hrew an exception.
at Cassette.Web.StartUp.PreApplicationStart()
[TargetInvocationException]: Exception has been thrown by the target of an invoc
ation.
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Ob
ject target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAt
tributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Obj
ect target, Object[] arguments, Signature sig, MethodAttributes methodAttributes
, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib
ilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at WebActivator.BaseActivationMethodAttribute.InvokeMethod()
at WebActivator.ActivationManager.RunActivationMethods[T]()
at WebActivator.ActivationManager.RunPreStartMethods()
at WebActivator.ActivationManager.Run()
[InvalidOperationException]: The pre-application start initialization method Run
on type WebActivator.ActivationManager threw an exception with the following er
ror message: Exception has been thrown by the target of an invocation..
at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`
1 methods)
at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appMan
ager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, Host
ingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception a
ppDomainCreationException)
[HttpException]: The pre-application start initialization method Run on type Web
Activator.ActivationManager threw an exception with the following error message:
Exception has been thrown by the target of an invocation..
at System.Web.Compilation.ClientBuildManager.EnsureHostCreated()
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
dManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.Precompiler.Main(String[] args)
I'd like to up-vote Xoltar's answer, but this is my first contribution to SO so I don't have the rep!
I had a very similar problem on our build-server (TeamCity), here's a clip from the build-log:
[00:10:39]: (MvcBuildViews target) ->
[00:10:39]: error ASPRUNTIME : The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation.. [C:\TeamCity\buildAgent\work\1ee8c94c32e676ad\source\Project.Site\Project.Site.csproj]
[00:10:39]: 0 Warning(s)
[00:10:39]: 1 Error(s)
[00:10:39]: Time Elapsed 00:00:27.93
To diagnose the problem I ran ASPNET_COMPILER, using the -errorstack argument against what MSBUILD had generated for site. In this case:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_compiler -p "C:\TeamCity\buildAgent\work\1ee8c94c32e676ad\source\Project.Site" -v anything -errorstack
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
error ASPRUNTIME: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message : Exception has been thrown by the target of an invocation..
[FileNotFoundException]: Could not load file or assembly 'msshrtmi, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()
error ASPRUNTIME: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message : Exception has been thrown by the target of an invocation..
In my case a dependency on one of the Azure assemblies (which wasn't installed on the build server) was the root of the problem.
Increase the verbosity level of the msbuild task or command line to get more detailed error messages.
For example, use /verbosity:detailed.
See http://msdn.microsoft.com/en-us/library/ms164311.aspx
Are you using Ninject?
If so, see this: http://groups.google.com/group/ninject/browse_thread/thread/1934e9260ba07ecd?pli=1 and this: http://www.techques.com/question/1-6173194/Strange-behaviour-when-using-Ninject-to-resolve-a-service-within-a-controller-factory
Are you using RavenDB?
If so, see this: http://groups.google.com/group/ravendb/browse_thread/thread/437738caf4760ce1/b7e92fd6cfeaaa17?#b7e92fd6cfeaaa17
In my case, I was seeing the message [AspNetCompiler] error ASPRUNTIME error message: Value cannot be null. in TeamCity.
In the full build logs, the more useful message at the bottom was:
error ASPRUNTIME : The pre-application start initialization method InitializePreStart on type MyApplication.MvcApplication threw an exception with the following error message: Value cannot be null.
As it turns out I had an exception being thrown by a method I had defined using PreApplicationStartMethod:
[assembly: System.Web.PreApplicationStartMethod(typeof(MyApp.MvcApplication), "InitializePreStart")]
namespace PrintFleet.PFE.RestService
{
public class MvcApplication : System.Web.HttpApplication
{
//....
public static void InitializePreStart()
{
// exception thrown here
}
}
}
The cause in my case was my prestart method was loading settings from the registry, and they didn't exist on the build server (but did on my machine, so it worked when I built it). I have no clue why webdeployment projects run this code.
I wrapped the entire thing in a try..catch that logs a fatal message (which in my app, goes to both the log file and windows event log). In builds, I don't really care if it fails since it doesn't need to do anything. In actual installations, if the settings are missing the app won't work (and so the log explains why).
Now, to the OP the problem seems to be in web activator. I would not be surprised if there is a method using webactivor in App_Start folder that is throwing the error, which is making it look like it's coming from WebActivator. Check there first, wrap things in try..catch if needed. It's also possible there is a bug in webactivator itself.
So because I came across this post while researching the problem, hopefully this information is useful to at least someone else.
TL;DR: Web deployment projects run the ApplicationPreStart methods when they compile. Ensure that you have try..catch blocks around any code run at prestart time or can otherwise handle the situation where the code is executed during compile time on your build server(s), outside of the IIS/hosting environment.

Resources