I am getting an error when trying to move my ASP.NET application from VS2010 to our IIS 6.0 webserver. The error happens on the first time the app tries to make a new SQLXMLCommand Object on the login page.
When navigating to the login page and entering valid credentials I got an error saying a null reference exception was thrown. Investigating into the exception we were able to determine another exception was being thrown and caught, causing the null reference exception later in the code.
The Corresponding line of code throwing the exception:
New SqlXmlCommand(conn.ConnectionString & ";Provider=SQLOLEDB.1;")
The exception causing the problems below:
Retrieving the COM class factory for component with CLSID {83D0FC3E-8B31-4B35-A1B2-346BA3954514} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {83D0FC3E-8B31-4B35-A1B2-346BA3954514} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Microsoft.Data.SqlXml.SqlXmlCommand.fillManagedWrapper() at Microsoft.Data.SqlXml.SqlXmlCommand.construct() at Microsoft.Data.SqlXml.SqlXmlCommand..ctor(String cnString) at dialogue.login.UserLogin(String username, St
2011-Jun-15 11:40:52.104 CriticalError N/A 58 "http://sigappsdv/dialogue/login.aspx" dialogue.login.UserLogin ---> "Webservice failed 2 at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Microsoft.Data.SqlXml.SqlXmlCommand.fillManagedWrapper() at Microsoft.Data.SqlXml.SqlXmlCommand.construct() at Microsoft.Data.SqlXml.SqlXmlCommand..ctor(String cnString) at dialogue.login.UserLogin(String username, String password, String lang)"
Looking further into the problem, the exception is only thrown on the Web Server. No exception is thrown if I am using localhost. I though I may be missing a reference to Microsoft.Data.SqlXml.dll as it was working localhost and not on the webserver. I tried fixing this by included the dll reference in my deployment project and making sure it was added to the bin folder, but with no avail.
Thanks, for the help.
Edit:
SQLXML 4.0 was not installed on our webserver, it was part of the baseline installation of my machine.
In addition to the managed SQLXML assembly, you need to install the native SQLXML library on the server.
The SQLXML libraries are documented at http://msdn.microsoft.com/en-us/library/ms171779.aspx, and you can find the installer at https://www.microsoft.com/en-us/download/details.aspx?id=30403
Related
I want to change one page on my ASP.Net 2.0/.Net 3.5SP1 application. The application is running on IIS6/Windows 2003. The application is precompiled so each page is composed of a ASPX file, a .compiled file, and a separate DLL assembly. These are mysite/olt2.aspx, mysite/bin/olt2.aspx.cdcab7d2.compiled, and mysite/bin/App_Web_ekkmrelo.dll. Note: the path has been changed for security reasons. The .compiled file appears to be the linkage between the olt2.aspx file and assembly.
The contents of the ASPX file, and .compiled file:
[Olt2.aspx]
This is a marker file generated by the precompilation tool, and should not be deleted!
[olt2.aspx.cdcab7d2.compiled]
<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="3" virtualPath="/mysite/OLT2.aspx" hash="617d394d4"
filehash="432defb6ed3bc6fc" flags="100000" assembly="App_Web_ekkmrelo"
type="ASP.olt2_aspx">
<filedeps>
<filedep name="/mysite/OLT2.aspx" />
<filedep name="/mysite/OLT2.aspx.cs" />
</filedeps>
</preserve>
I compiled a new page in my development environment and it produced a new assembly and .compiled file. The only changes to the new version of olt2.aspx are alterations to JavaScript. The new .compiled file:
[olt2.aspx.cdcab7d2.compiled]
<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="3" virtualPath="/mysite/OLT2.aspx" hash="617d394d4"
filehash="435cf6a2206e330f" flags="100000" assembly="App_Web_n1jva4in" type="ASP.olt2_aspx">
<filedeps>
<filedep name="/mysite/OLT2.aspx" />
<filedep name="/mysite/OLT2.aspx.cs" />
</filedeps>
</preserve>
I added the new assembly "App_Web_n1jva4in.DLL" to the bin folder, and replaced olt2.aspx.cdcab7d2.compiled with the new version. The security on the newly added DLL matches other DLL in the bin folder. But when I attempt to open OLT2.aspx I get an error (see below). I have tried stopping the application pool, deleting the temp asp files. If I replace olt2.aspx.cdcab7d2.compiled with the original version, the page loads.
The exception details
The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested.
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.Web.HttpException: The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested.
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:
[HttpException (0x80004005): The file '/twrr2/olt2.aspx' has not been pre-compiled, and cannot be requested.]
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +8844526
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
My questions
Is there a reason why this cannot be done? Is there a way to make this work, or pinpoint the problem?
While writing up the question for stackoverflow, I wondered if there were some dependencies in the new assembly that had changed. To answer that, I used ILSpy http://ilspy.net and sure enough there were references to these assemblies: App_Web_wlaluoz4.dll and App_Web_mkzxmd4c.dll. I copied those two assemblies into the bin folder. Using ILSpy, I checked that the newly added assemblies did not have other dependencies, and fortunately they did not.
The new version of Olt2.aspx page worked!
Okay so, I have been given the responsibility to migrate a website with multiple applications to another server. That migration went well (all applications working). However, the performance of that new server was sub par (whole other story). We decided to migrate it again. This time everything is working very well-- except one application.
It worked just fine on the first and second IIS servers, but is refusing to cooperate this time around.
I've mirrored all the config settings that I could find from the working server:
windows authentication enabled: check
Impersonation disabled: check
applicationpool settings match: check
I just don't know what I'm missing; why would it work on one server, but not the other.
An operations error occurred.
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.Runtime.InteropServices.COMException: An operations error occurred.
Source Error:
Line 9: Dim myUsername As String = Right(User.Identity.Name, Len(User.Identity.Name) - InStr(User.Identity.Name, "\"))
Line 10: Dim ctx = New PrincipalContext(ContextType.Domain)
Line 11: Dim myUser = UserPrincipal.FindByIdentity(ctx, myUsername)
Line 12: hfValid.Value = "false"
Line 13: For Each gp As GroupPrincipal In myUser.GetAuthorizationGroups
Source File: D:\mghnet1\isOnCall\Default.aspx.vb Line: 11
COMException (0x80072020): An operations error occurred
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +378142
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
System.DirectoryServices.PropertyValueCollection.PopulateList() +26
System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +49
System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +150
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +1114
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +37
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +112
System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +31
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +14
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue) +73
System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +28
_Default.Page_Load(Object sender, EventArgs e) in D:\mghnet1\isOnCall\Default.aspx.vb:11
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5456
Please help, none of the other forum posts I've found have posted solutions that work for me.
I have the following files: View.ascx, View.ascx.cs, View.ascx.resx . In the file View.ascx.resx, I'm have a lot of trouble reading the value for the key EmailAddress.Text from my code behind.
I tried this:
object keyValue = System.Web.HttpContext.GetLocalResourceObject("~/View.aspx", "EmailAddress", culture);
EmailAddress.Attributes["placeholder"] = keyValue.ToString();
And it gave me the error:
Error: Contact is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: The resource class for this page was not found. Please check if the resource file exists and try again. ---> System.InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again. at System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager() at System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager() at System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture) at System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName) at System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey, CultureInfo culture) at com.John.Contact.View.Page_Load(Object sender, EventArgs e) in C:\Users\john\Documents\My Web Sites\v624\DesktopModules\Contact\View.ascx.cs:line 74 --- End of inner exception stack trace ---
I tried this:
ResourceManager rm = new ResourceManager("items", System.Reflection.Assembly.GetExecutingAssembly());
String r = rm.GetString("EmailAddress");
And it gave me this error:
Error: Contact is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "items.resources" was correctly embedded or linked into assembly "Contact" at compile time, or that all the satellite assemblies required are loadable and fully signed. ---> System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "items.resources" was correctly embedded or linked into assembly "Contact" at compile time, or that all the satellite assemblies required are loadable and fully signed. at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName) at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.GetString(String name, CultureInfo culture) at System.Resources.ResourceManager.GetString(String name) at com.John.Contact.View.Page_Load(Object sender, EventArgs e) in C:\Users\john\Documents\My Web Sites\v624\DesktopModules\Contact\View.ascx.cs:line 80 --- End of inner exception stack trace ---
I tried several other example from the asp.net code library, but kept getting other errors. How do I grab a value from the View.ascx.resx file?
Ok finally figured it out. I have to use the DotNetNuke API because this is a DotNetNuke project.
String s = DotNetNuke.Services.Localization.Localization.GetString("EmailAddress",this.LocalResourceFile);
I've just noticed that when running an application I periodically get an error message.
Server Error in '/' Application.
Buffer cannot be null.
Parameter name: buffer
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.ArgumentNullException: Buffer cannot be null.
Parameter name: buffer
Stack trace:
[ArgumentNullException: Buffer cannot be null.
Parameter name: buffer]
System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +12627669
MemcachedProviders.Session.Common.Deserialize(HttpContext context, Byte[] serializedItems, Int32 timeout) +47
MemcachedProviders.Session.Db.SQLDbOperations.GetItem(String strSessionId, String strApplicationName, Int32 iTime, HttpContext context, Boolean lockRecord, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +1221
MemcachedProviders.Session.SessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +1069
System.Web.SessionState.SessionStateModule.GetSessionStateItem() +178
System.Web.SessionState.SessionStateModule.PollLockedSessionCallback(Object state) +299
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.SessionState.SessionStateModule.EndAcquireState(IAsyncResult ar) +11513726
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +107
Our application uses Enyim memcached and MemcachedProviders and runs in a load balanced environment.
The application does alot of managing of PDF reports and compiling of responses then generating a final report pdf. So we use streams quite a bit.
This problem only appears to affect our management application as we also expose a webservice and I never get the error when looking at the service definition and WSDL.
From looking at the session table in the DB I can see that they are being created but, many of them have null in the SessionItems field and the locked flag set to 1.
The data time stamps seem to correlate to the null buffer error occurances.
Is this a case of a buffer set incorrectly or maxing out?
I have a web application and when I decided to test on IIS 7 i have this Exception when trying to load a couple of pages that uses Entity Framework 4. I use EF 4 with my own CRUD assemblies but sometimes using the EntityDataSource. I have noticed that the problem is not appearing in all my Web Pages but I think in those that I use the EntityDataSource.
Here's the log from a Page:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
mscorlib
System.Type[] GetTypes(System.Reflection.RuntimeModule)
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly()
at System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load()
at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData)
at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors)
at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.ExplicitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.MetadataWorkspace.ExplicitLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action`1 logLoadMessage)
at System.Web.UI.WebControls.EntityDataSourceView.ConstructContext()
at System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
................it's not complete but I guess you can see the latest breadcumb...
Just for more info i post another page problem.
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
mscorlib
System.Type[] GetTypes(System.Reflection.RuntimeModule)
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly()
at System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load()
at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData)
at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors)
at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.ExplicitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.MetadataWorkspace.ExplicitLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action`1 logLoadMessage)
at System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action`1 logLoadMessage)
at System.Web.UI.WebControls.EntityDataSourceView.ConstructContext()
at System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.FormView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.FormView.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I think its the EDM problem but I can't get through.
I should mention that in my development pc is working all perfectly!!!
My controls are DevExpress but I dont think this should play any role!
Thank you.
[EDIT]
Thank you RD for edit.
Forgot to mention that I use Self tracking Template with the Entities.tt in a separate assembly!
[EDIT 2]
On my local Windows 7 IIS works OK! It's Windows Server 2008 I can't get it done!
This was an error as it seems that assemblies are not loaded. The app needed assemblies that I dont use into my application but I guess it searches using reflection. This had to do with DevExpress assemblies that I guess are referenced or loaded from reflection in another DevExpress assembly. The solution is to Log the LoaderExceptions and see what assembly u need.