DNN 7 General Exception - asp.net

I am creating Costume DNN Module but I have "General Exception" happening recently. just want to ask if anyone get this error " General Exception" and how to fix it
AssemblyVersion: 7.0.5
PortalID: -1
PortalName:
UserID: -1
UserName:
ActiveTabID: -1
ActiveTabName:
RawURL:
AbsoluteURL:
AbsoluteURLReferrer:
UserAgent:
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID: 19286ea9-9154-4453-93d3-f58e3e143f64
InnerException: Error Creating BusinessControllerClass 'DotNetNuke.Modules.ResourceModule.Components.FeatureController' of module(ResourceModule) id=(637) in tab(144) and portal(0)
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Activator.CreateInstance
StackTrace:
Message: System.Exception: Error Creating BusinessControllerClass 'DotNetNuke.Modules.ResourceModule.Components.FeatureController' of module(ResourceModule) id=(637) in tab(144) and portal(0) ---> System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at DotNetNuke.Services.Search.ModuleIndexer.GetModuleList(Int32 PortalID) --- End of inner exception stack trace --- at DotNetNuke.Services.Search.ModuleIndexer.GetModuleList(Int32 PortalID)
Source:
Server Name:

That is an easy one, fixed in the next Template release. https://christoctemplate.codeplex.com/discussions/440995
Basically, update your .DNN file to include the proper namespace for your BusinessController class, I left a hardcoded one in there by mistake in one of the templates.

Related

Databases have "Recovery Pending" status every few hours

I recently noticed that most of the databases on my SQL Server are getting the Recovery Pending status after running for a few hours (sometimes 6, sometimes more). I can't imagine this being the expected outcome, so I decided to post about it here.
I opened the Event Log viewer and decided to find some more info about what's going on. It seems that all my databases are "Starting up" every few minutes or so (as cam be seen here). Some of them get started multiple times in a row. Is that supposed to work like that?
After scrolling a bit more, I found this warning from one of my IIS websites:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 4/11/2018 9:32:05 AM
Event time (UTC): 4/11/2018 7:32:05 AM
Event ID: 7911bb726cd34d36941e8232ad78b059
Event sequence: 18
Event occurrence: 3
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/5/ROOT-1-131679051910980983
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\x\
Machine name: WIN-IV6CMBTUQ4N
Process information:
Process ID: 2400
Process name: w3wp.exe
Account name: IIS APPPOOL\x
Exception information:
Exception type: HttpException
Exception message: The remote host closed the connection. The error code is 0x80070057.
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write(ArraySegment`1 data)
at Microsoft.AspNet.SignalR.Hosting.ResponseExtensions.End(IResponse response, String data)
at Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners`2.<>c__DisplayClass2_0.<RunTask>b__0(Task t)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Request information:
Request URL: http://91.134.116.40:8003/signalr/start?clientProtocol=1.4&transport=webSockets&connectionData=[{"Name":"ChatHub"}]&connectionToken=/y39a+1XOv/u7X/ZFYw5ACLQu58FVNl0hbkMwPHCw1EQ9gdCbpFxPQzPuJVDxRywoP2AaI6akuXxQIxM2Wwa0OLO4cWd/e3csUBetjb9nROsisQnavw52ulTHWVOjK/j&user=User-14D
Request path: /signalr/start
User host address: 24.13.101.142
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\x
Thread information:
Thread ID: 14
Thread account name: IIS APPPOOL\x
Is impersonating: False
Stack trace: at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.AspNet.SignalR.Owin.ServerResponse.Write(ArraySegment`1 data)
at Microsoft.AspNet.SignalR.Hosting.ResponseExtensions.End(IResponse response, String data)
at Microsoft.AspNet.SignalR.TaskAsyncHelper.TaskRunners`2.<>c__DisplayClass2_0.<RunTask>b__0(Task t)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
Seems like there's something wrong with SignalR, so it shouldn't have any direct relation with the database, but there aren't any other errors/warnings there.
Am I missing something here?
Thank you!
Do you have "auto close" enabled on the database?
Best practice is to have it OFF
ALTER DATABASE <mydb> SET AUTO_CLOSE OFF
I would also check AUTO_SHRINK while I was there

How can I specify the ASP.NET probing path for automatic C++/CLI appdomains?

I have a C++/CLI DLL that needs to run in the context of an ASP.NET WebApi action.
The action is affected by an ActionFilter that uses log4net's LogicalThreadContext to set a property containing a request ID; this works nicely to write the request ID into the log entries.
The problem is that ASP.NET seems to be creating an appdomain when it's time to load the class from the C++/CLI dll. (I can't seem to find any documentation on how that works; I'd love to find some.) When the appdomain plumbing tries to deserialize everything, it chokes because it can't find log4net.dll (see stack trace below).
Fusion logs show that it's looking in C:\Windows\System32\inetsrv, which is incorrect... I would expect it to look in the probing path or along the %PATH% environment variable.
A few data points:
log4net.dll is available in the web app's bin directory and works fine for everything else I'm using it for.
The C++/CLI code has no dependencies on log4net.
If I comment out my calls to log4net.LogicalThreadContext.Properties[...], everything works fine.
If I copy log4net.dll from my bin folder to C:\Windows\system32\inetsrv, everything works fine.
The web.config file specifies the probing path with a <probing privatePath="bin"/> element.
My Application_Start method in global.asax.cs prepends the web app's bin directory to the %PATH% environment variable:
var currentPathEnvVar = Environment.GetEnvironmentVariable("PATH");
var binPath = Path.Combine(Server.MapPath("~") ?? String.Empty, "bin");
_log.DebugFormat("Prepending paths to PATH: [{0}]", binPath);
Environment.SetEnvironmentVariable("PATH", String.Concat(binPath, Path.PathSeparator, currentPathEnvVar));
The log shows that the %PATH% is getting prepended correctly:
2015-06-05 17:07:48,816 1 DEBUG MyNamespace.WebApiApplication (null) Prepending paths to PATH: [C:\Program Files\MyCompany\MyApp\web\bin]
So how do I get the appdomain that ASP.NET creates to look in the right place to load assemblies?
Thanks.
Here's the stack trace that gets logged when all this goes down.
2015-06-05 17:08:41,148 23 ERROR MyNamespace.MyController (null) Controller action failed
System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
---> System.Runtime.Serialization.SerializationException: Unable to find assembly 'log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'.
Server stack trace:
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain()
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AppDomain.IsDefaultAppDomain()
at <CrtImplementationDetails>.GetDefaultDomain() in f:\dd\vctools\crt\crtw32\h\minternal.h:line 367
at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) in f:\dd\vctools\crt\crtw32\h\minternal.h:line 401
at <CrtImplementationDetails>.DefaultDomain.Initialize() in f:\dd\vctools\crt\crtw32\msilcrt\mstartup.cpp:line 278
at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* ) in f:\dd\vctools\crt\crtw32\msilcrt\mstartup.cpp:line 343
at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) in f:\dd\vctools\crt\crtw32\msilcrt\mstartup.cpp:line 546
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) in f:\dd\vctools\crt\crtw32\msilcrt\mstartup.cpp:line 703
--- End of inner exception stack trace ---
at <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, Exception innerException) in f:\dd\vctools\crt\crtw32\h\minternal.h:line 194
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) in f:\dd\vctools\crt\crtw32\msilcrt\mstartup.cpp:line 713
at .cctor() in f:\dd\vctools\crt\crtw32\msilcrt\mstartup.cpp:line 754
--- End of inner exception stack trace ---
at MyNamespace.MyController.MyAction(String foo, Int64 bar, String baz)
This helped me to resolve similar issue:
https://blogs.msdn.microsoft.com/jorman/2007/08/31/loading-c-assemblies-in-asp-net/
Faced option 2.a and proposed solution worked fine:
protected void Application_Start(object sender, EventArgs e){
String _path = String.Concat(System.Environment.GetEnvironmentVariable("PATH"), ";",
System.AppDomain.CurrentDomain.RelativeSearchPath);
System.Environment.SetEnvironmentVariable("PATH", _path, EnvironmentVariableTarget.Process); }

Error using SignalR utility Crank.exe

I'm using crank to load test my signalr application. The command that I'm using is as follows
crank /NumClients:100 /Url:http://localhost:29573/TestConnection /BatchSize:10
I'm getting an exception in my powershell window as follows...
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object
reference not set to an instance of an object.
at Microsoft.AspNet.SignalR.Client.HubConnection.GetUrl(String url, Boolean useDefaultUrl) in c:\Users\t-niraj\Deskto
p\SignalR-master\src\Microsoft.AspNet.SignalR.Client\HubConnection.cs:line 216
at Microsoft.AspNet.SignalR.Client.HubConnection..ctor(String url, Boolean useDefaultUrl) in c:\Users\t-niraj\Desktop
\SignalR-master\src\Microsoft.AspNet.SignalR.Client\HubConnection.cs:line 38
at Microsoft.AspNet.SignalR.Client.HubConnection..ctor(String url) in c:\Users\t-niraj\Desktop\SignalR-master\src\Mic
rosoft.AspNet.SignalR.Client\HubConnection.cs:line 28
at Microsoft.AspNet.SignalR.Crank.Client.<OpenControllerConnection>d__6.MoveNext() in c:\Users\t-niraj\Desktop\Signal
R-master\src\Microsoft.AspNet.SignalR.Crank\Client.cs:line 71
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.SignalR.Crank.Client.<Run>d__0.MoveNext() in c:\Users\t-niraj\Desktop\SignalR-master\src\Microsof
t.AspNet.SignalR.Crank\Client.cs:line 43
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Microsoft.AspNet.SignalR.Crank.Client.Main() in c:\Users\t-niraj\Desktop\SignalR-master\src\Microsoft.AspNet.Signa
lR.Crank\Client.cs:line 34
I do have the sample application: SignalR.LoadTestHarness running at localhost:29573. This is the same application that is found in the SignalR source code samples.
What am I doing wrong?
You did not provide the ControllerUrl parameter and as a result crank is trying to create a hub connection with null Url which results in throwing a NullReferenceException on this line.

Reflecting Assemblies on Mono for Android

I'm creating an app "plugin" dll that loads at run-time for my Mono for Android App and starts a new Activity. (the app will be installed ad-hoc - so no comments on downloading executable code)
I'm coming from Obj-C on iOS - where you can include .nibs and ViewControllers in a library.
I can have the main Android app and the loaded dll both reference another common dll, and load objects just fine.
The following works:
var test = plugin.CreateInstance("Test.Satellite.testClass");
MethodInfo getString = test.GetType().GetMethod("getString");
MethodInfo tryPatient = test.GetType().GetMethod("tryPatient");
Where
public class testClass
{
public string getString ()
{
return "This was read from the object";
}
public string tryPatient ()
{
Patient p = new Patient();
p.Name = "This was created from the Core/Common DLL";
return p.Name;
}
}
However, when I try to load an Activity (either through CreateInstance or Intent/StartActivity) it gives the following exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: test.satellite.RootActivity
at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00087] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:275
at Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00009] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:233
--- End of managed exception stack trace ---
java.lang.NoClassDefFoundError: test.satellite.RootActivity
at test.MainActivity.n_onCreate(Native Method)
at test.MainActivity.onCreate(MainActivity.java:29)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: test.satellite.RootActivity in loader dalvik.system.PathClassLoader#44e8c678
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
... 15 more
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x000e0, 0x00670>
at System.Reflection.MethodBase.Invoke (object,object[]) <IL 0x00006, 0x0008f>
at Test.MainActivity.OnCreate (Android.OS.Bundle) [0x001e9] in /Users/stephen/Projects/test/test/MainActivity.cs:86
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.7-branch/0e9eea34/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.App.Activity.cs:1490
at (wrapper dynamic-method) object.ca46b703-b14e-4853-b371-499ea96364fc (intptr,intptr,intptr) <IL 0x00012, 0x00033>
What I can read from that is that the Dalvik can't find the class test.satellite.RootActivity - but it found test.satellite.testClass just fine...?
Any help would be appreciated.
It looks like you are inconsistent about the casing of packages. Might that be the problem?
"Test.Satellite.testClass" -- works
"test.satellite.RootActivity" -- doesn't work

aspx.net gives blank error message

What could this blank error message mean? I get it randomly in my LOGS. I am using non-cookie sessions. it occurs randomly in all aspx files..
code handler outputs:
objErr = Server.GetLastError().GetBaseException()
Server.ClearError()
Error Message: & objErr.Message.ToString())
Stack Trace: & objErr.StackTrace.ToString())
output
Error Message:
Stack Trace:
at System.Web.CachedPathData.GetConfigPathData(String configPath) at
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean
permitPathsOutsideApp) at System.Web.HttpContext.GetFilePathData() at
System.Web.HttpContext.GetConfigurationPathData() at
System.Web.HttpContext.get_ImpersonationToken() at
System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError) at
System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext) at
System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext) at
System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
Is this an inner exception that you are seeing?
regarding ToString():
If there is no error message or if it is an empty string (""), then no error message is returned. The name of the inner exception and the stack trace are returned only if they are not a null reference
Here's a link

Resources