Umbraco 4.7 SqlCe Medium trust System.TypeInitializationException
I have umbraco 4.7 running locally just fine.
It's my first play with SqlCe with Umbraco as it is for a small no thrills site.
Moved to Hosted server (medium trust) and it just isn't liking the SqlCe .. connection doesn't seem to be happening.
The environment is definately the problem, but it is how I fix the install or know what to request the hosting provider to change.
I have MVC sites running SqlCe on the hosting, so it is about getting it configured.
Here is the full error
Error running Reader: SQL Statement: select id, domainName from umbracoDomains
Exception: System.TypeInitializationException:
The type initializer for 'System.Data.SqlServerCe.SqlCeConnection'
threw an exception. ---> System.TypeInitializationException: The type
initializer for 'System.Data.SqlServerCe.KillBitHelper' threw an
exception. ---> System.InvalidOperationException: Cannot perform CAS
Asserts in Security Transparent methods at
System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark,
Int32 create) at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark) at System.Security.CodeAccessPermission.Assert() at System.Data.SqlServerCe.KillBitHelper.GetKillBit() at System.Data.SqlServerCe.KillBitHelper..cctor() --- End of inner exception stack trace --- at System.Data.SqlServerCe.KillBitHelper.ThrowIfKillBitIsSet() at System.Data.SqlServerCe.SqlCeParameter..cctor() --- End of inner exception stack trace --- at System.Data.SqlServerCe.SqlCeConnection..ctor()
at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteReader(String
connectionString, CommandType commandType, String commandText,
SqlCeParameter[] commandParameters)
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: System.TypeInitializationException:
The type initializer for 'System.Data.SqlServerCe.SqlCeConnection'
threw an exception. ---> System.TypeInitializationException: The type
initializer for 'System.Data.SqlServerCe.KillBitHelper' threw an
exception. ---> System.InvalidOperationException: Cannot perform CAS
Asserts in Security Transparent methods at
System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark,
Int32 create) at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark) at System.Security.CodeAccessPermission.Assert() at System.Data.SqlServerCe.KillBitHelper.GetKillBit() at System.Data.SqlServerCe.KillBitHelper..cctor() --- End of inner exception stack trace --- at System.Data.SqlServerCe.KillBitHelper.ThrowIfKillBitIsSet() at System.Data.SqlServerCe.SqlCeParameter..cctor() --- End of inner exception stack trace --- at System.Data.SqlServerCe.SqlCeConnection..ctor()
at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteReader(String
connectionString, CommandType commandType, String commandText,
SqlCeParameter[] commandParameters)
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:
[SqlCeProviderException: Error running Reader:
SQL Statement:
select id, domainName from umbracoDomains
Exception:
System.TypeInitializationException: The type initializer for 'System.Data.SqlServerCe.SqlCeConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlServerCe.KillBitHelper' threw an exception. ---> System.InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods
at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 create)
at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Assert()
at System.Data.SqlServerCe.KillBitHelper.GetKillBit()
at System.Data.SqlServerCe.KillBitHelper..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlServerCe.KillBitHelper.ThrowIfKillBitIsSet()
at System.Data.SqlServerCe.SqlCeParameter..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlServerCe.SqlCeConnection..ctor()
at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)]
SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters) +224
SqlCE4Umbraco.SqlCEHelper.ExecuteReader(String commandText, SqlCeParameter[] parameters) +37
umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters) +87
[SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteReader]
umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters) +142
umbraco.cms.businesslogic.web.Domain.<GetDomains>b__0() +89
umbraco.cms.businesslogic.cache.Cache.GetCacheItem(String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem) +132
umbraco.cms.businesslogic.web.Domain.GetDomains() +158
umbraco.cms.businesslogic.web.Domain.GetDomain(String DomainName) +44
umbraco.requestHandler.CreateXPathQuery(String url, Boolean checkDomain) +232
umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url) +523
umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) +977
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreInit(EventArgs e) +8876158
System.Web.UI.Page.PerformPreInit() +31
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328
Any direction, thoughts, help would be appreciated.
I am having this same issue. Has anyone had any success running any version of 4.7x in Medium Trust? This is such a big barrier for installation. Is there any current documentation on which version to use and and other settings or permissions that need to be changed for this to work? I have 3 clients right now where I need to get this working at their existing hosting provider on a shared server.
Umbraco 4.7 SqlCe Medium trust System.TypeInitializationException
I have umbraco 4.7 running locally just fine.
It's my first play with SqlCe with Umbraco as it is for a small no thrills site.
Moved to Hosted server (medium trust) and it just isn't liking the SqlCe .. connection doesn't seem to be happening.
The environment is definately the problem, but it is how I fix the install or know what to request the hosting provider to change.
I have MVC sites running SqlCe on the hosting, so it is about getting it configured.
Here is the full error
Error running Reader:
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.SQL Statement:
select id, domainName from umbracoDomains
Exception:
System.TypeInitializationException: The type initializer for 'System.Data.SqlServerCe.SqlCeConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlServerCe.KillBitHelper' threw an exception. ---> System.InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods
at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 create)
at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Assert()
at System.Data.SqlServerCe.KillBitHelper.GetKillBit()
at System.Data.SqlServerCe.KillBitHelper..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlServerCe.KillBitHelper.ThrowIfKillBitIsSet()
at System.Data.SqlServerCe.SqlCeParameter..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlServerCe.SqlCeConnection..ctor()
at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)
Exception Details: SqlCE4Umbraco.SqlCeProviderException: Error running Reader:
SQL Statement:
select id, domainName from umbracoDomains
Exception:
System.TypeInitializationException: The type initializer for 'System.Data.SqlServerCe.SqlCeConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlServerCe.KillBitHelper' threw an exception. ---> System.InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods
at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 create)
at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Assert()
at System.Data.SqlServerCe.KillBitHelper.GetKillBit()
at System.Data.SqlServerCe.KillBitHelper..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlServerCe.KillBitHelper.ThrowIfKillBitIsSet()
at System.Data.SqlServerCe.SqlCeParameter..cctor()
--- End of inner exception stack trace ---
at System.Data.SqlServerCe.SqlCeConnection..ctor()
at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)
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:
Any direction, thoughts, help would be appreciated.
Cheers!
Comment author was deleted
4.7 doesn't work on medium trust, try the nightly build of 4.7.1 instead: http://nightly.umbraco.org/umbraco%204.7/4.7%20RC/
Thanks Tim! I'll have a go :)
Hey Tim,
I removed the current install, uploaded a new version from the nightly build (4.7.1.392), then copied the required SqlCe files to the server.
When it starts to install the database it errors "Database connection initialisation failed."
Any other ideas? Might be easier to use a full MSSQL version instead, but would like to get this site on a Compact Edition.
P
I am having this same issue. Has anyone had any success running any version of 4.7x in Medium Trust? This is such a big barrier for installation. Is there any current documentation on which version to use and and other settings or permissions that need to be changed for this to work? I have 3 clients right now where I need to get this working at their existing hosting provider on a shared server.
4.7 in medium trust isn't a problem. The SqlCe in medium trust was.
Isn't it possible to upgrade the hosting to full trust?
is working on a reply...