SQL Server 2012 installation error: Landing Page - sql-server

After uninstalling SQL Server 2012 and 2008, then reinstalling, I get this error:
Unhandled exception has occurred in your application...
An error occurred creating the configuration section handler for userSettings/Microsoft.SqlServer.Configuration.LandingPage.Properties.Settings:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for userSettings/Microsoft.SqlServer.Configuration.LandingPage.Properties.Settings: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. (C:\Users\hy\AppData\Local\Microsoft_Corporation\LandingPage.exe_StrongName_ryspccglaxmt4nhllj5z3thycltsvyyx\10.0.0.0\user.config line 5) ---> System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
File name: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--- End of inner exception stack trace ---
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ClientSettingsStore.ReadSettings(String sectionName, Boolean isUserScoped)
at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties)
at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
at System.Configuration.SettingsBase.get_Item(String propertyName)
at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
at Microsoft.SqlServer.Configuration.LandingPage.LandingPageForm.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Delete the
C:\Users\hy\AppData\Local\Microsoft_Corporation\LandingPage.exe_StrongName_ryspccglaxmt4nhllj5z3thycltsvyyx\
directory, and try again.
I believe the uninstall sometimes does not clean up the files completely.

Search in this folder:
C:\Users\user_name\AppData\Local\Microsoft_Corporation
There you will find files or folders like
LandingPage.exe,
or
LandingPage.
Delete all these folders.
Works for Windows 10.

You should be able to find it if you search for %localappdata%\Microsoft_Corporation%

Rename the user.config file located at
C:\Users[USER_NAME]\AppData\Local\Microsoft_Corporation\LandingPage.exe_StrongName_ryspccglaxmt4nhllj5z3thycltsvyyx\10.0.0.0
to
USER.CONFIG.BAK

Delete this Folder C:\Users\yourName\AppData\Local\Microsoft_Corporation\LandingPage.exe_StrongName_ryspccglaxmt4nhllj5z3thycltsvyyx\

Run the command: rd /s /q %localappdata%\Microsoft_Corporation1as

Related

The located assembly's manifest definition does not match the assembly reference : Exception from HRESULT: 0x80131040

In my project microsoft.owin has version 3.1.0.0 but it asks for older version
2.1.0.0 . I tried to install microsoft.owin but haven't succeeded . My project
framework is 4.5.2 . I tried to install nuget package of this assembly but it's not installed . Can anyone tell me how to solve this error . How can install package 2.1.0.0 version . I tried to redirect it but same error .
ERROR
Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 65: // ClientSecret = ""
Line 66: //});
Line 67: }
Line 68: }
Line 69: }
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/xxxx/yyyy/uuuu/ldap/
LOG: Initial PrivatePath = C:\xxxx\yyyy\uuuu\ldap\bin
Calling assembly : Microsoft.AspNet.Identity.Owin, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\xxxx\yyyy\uuuu\ldap\web.config
LOG: Using host configuration file: \\xyz.df.xcxc.com\sdsds\yuyuy\****\My Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/****/AppData/Local/Temp/Temporary ASP.NET Files/root/b0f32b6a/7c9b41cc/Microsoft.Owin.DLL.
LOG: Attempting download of new URL file:///C:/Users/****/AppData/Local/Temp/Temporary ASP.NET Files/root/b0f32b6a/7c9b41cc/Microsoft.Owin/Microsoft.Owin.DLL.
LOG: Attempting download of new URL file:///C:/xxxx/yyyy/uuuu/ldap/bin/Microsoft.Owin.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
ldap.Startup.ConfigureAuth(IAppBuilder app) in C:\xxxx\yyyy\uuuu\ldap\App_Start\Startup.Auth.cs:67
ldap.Startup.Configuration(IAppBuilder app) in C:\xxxx\yyyy\uuuu\ldap\Startup.cs:9
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
Owin.Loader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuilder builder) +93
Owin.Loader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder) +212
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +873
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +51
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +101
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688
please help to solve this issue . how to install the older version of microsoft.owin .
One solution is to downgrade your version of Microsoft.Owin.
Right-click your project in Visual Studio.
Choose "Manage Nuget Packages...".
Under Installed, choose "Microsoft.Owin".
In the "Version" dropdown, choose 2.1.0
Click "Update".

Why am I getting "Unable to load the specified metadata resource" error?

I have an MVC5 web application which I usually develop using my laptop.
I am trying to get the app running on my main machine at home for home-working days but have a problem connecting to the local dev database on SQL Server - when I start the app I get the following error:
More info 30/11/16:
Note that the model is generated from EDML using Entity Developer
Unable to load the specified metadata resource. 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.
The solution consists of 2 projects, one of which is an entity model project which is generated from EDMX.
Note: On my main machine (where it isn't working) the connection string in Web.config is the same as the machine where it works except for Data Source which refers to the SQL Server name on the main machine - I have checked this is correct several times:
I have read several Stack Overflow posts with similar issues - most point to something wrong with the path to the csdl, ssdl, msl part of the connection string.
I have:
Checked the server name is correct in the connection string
Checked the database name is correct in the connection string
Checked the database exists and is available
Checked each of the three files are where the connection string says they are (they are)
Tried using wildcard in the connection string: res://*/dllname.csdl|res://*/dllname.ssdl|res://*/dllname.msl
Update 30/11/2016:
From the suggestions in this link I have:
Checked the MetadataArtifactProcessing property - it is not set to Copy to Output directory
Checked the connection string
We don't have a post-compile task
From the suggestion in this link I have tried setting the connection string connectionString="metadata=res://*/;
Stack Trace:
[MetadataException: Unable to load the specified metadata resource.]
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.LoadResource() +85
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.CreateReader() +10
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.CreateReaders(DataSpace spaceToGet) +72
System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderComposite.CreateReaders(DataSpace spaceToGet) +99
System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadEdmItemCollection(MetadataArtifactLoader loader) +41
System.Data.Entity.Core.Metadata.Edm.<>c__DisplayClass5.<GetMetadataWorkspace>b__0(String k) +37
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(String cacheKey, MetadataArtifactLoader artifactLoader) +75
System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions) +126
System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace() +43
System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection() +20
System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory) +393
System.Data.Entity.Core.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +35
App.Models.Entities..ctor() in C:\Users\Me\Desktop\App\App.MVC5\App.Entities.cs:37
App.MVC5.Models.CurrentUser..ctor(Boolean IsGuiDetailsRequired) in C:\Users\Me\Desktop\App\App.MVC5\Models\AccountModels.cs:87
App.MVC5.Controllers.HomeController..ctor() in C:\Users\Me\Desktop\App\App.MVC5\Controllers\HomeController.cs:11
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +114
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
System.Activator.CreateInstance(Type type) +11
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +55
[InvalidOperationException: An error occurred when trying to create a controller of type 'App.MVC5.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +178
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +76
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +88
Castle.Proxies.Invocations.IControllerFactory_CreateController.InvokeMethodOnTarget() +118
Castle.DynamicProxy.AbstractInvocation.Proceed() +80
Glimpse.Core.Extensibility.CastleInvocationToAlternateMethodContextAdapter.Proceed() +11
Glimpse.Core.Extensions.AlternateMethodContextExtensions.TryProceedWithTimer(IAlternateMethodContext context, TimerResult& timerResult) +41
Glimpse.Core.Extensibility.AlternateMethod.NewImplementation(IAlternateMethodContext context) +25
Glimpse.Core.Extensibility.AlternateTypeToCastleInterceptorAdapter.Intercept(IInvocation invocation) +84
Castle.DynamicProxy.AbstractInvocation.Proceed() +108
Castle.Proxies.IControllerFactoryProxy.CreateController(RequestContext requestContext, String controllerName) +214
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +194
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +50
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
There's a very popular question over there and from its rating I can assume it helped a lot of people. It even mentions a blog post with complete troubleshooting for this problem. Also, this answer looks like something you didn't try yet.

Error after upgrading from DNN 7.0 to 7.4.1 (Version Upgrade package)

After completing an upgrade to DNN 7.4 I get the error outlined below. Everything went smoothly and there were no errors in the install log. This happens on any page, and there are no new dependencies on Visual Studio I presume...
2015-06-12 17:43:49,567 [scrumorg-stage][Thread:5][ERROR] DotNetNuke.Common.Internal.EventHandlersContainer`1[[DotNetNuke.Services.FileSystem.IFileEventHandlers, DotNetNuke, Version=7.4.1.280, Culture=neutral, PublicKeyToken=null]] - The type initializer for 'DotNetNuke.ExtensionPoints.ExtensionPointManager' threw an exception.
System.TypeInitializationException: The type initializer for 'DotNetNuke.ExtensionPoints.ExtensionPointManager' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable)
at System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable()
at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(Type type, ICompositionElement origin)
at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal()
at System.ComponentModel.Composition.Hosting.TypeCatalog.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at DotNetNuke.ExtensionPoints.SafeDirectoryCatalog..ctor(String directory)
at DotNetNuke.ExtensionPoints.ExtensionPointManager.InitializeMefCompositionContainer()
at DotNetNuke.ExtensionPoints.ExtensionPointManager..cctor()
--- End of inner exception stack trace ---
at DotNetNuke.ExtensionPoints.ExtensionPointManager.ComposeParts(Object[] attributeParts)
at DotNetNuke.Common.Internal.EventHandlersContainer`1..ctor()
Any ideas what I'm missing or what might be happening?
So this issue ended up being a custom DLL found in the BIN folder of the DNN website that Ryan was upgrading.
My non-scientific approach to resolving this was to:
Remove DLLS in bulk in the BIN folder (keep a copy of the DLLs as you aren't sure which one is the problem, put them back after testing)
Load the site (using admin/site settings page)
See if page still errored, if so, repeat steps 1 and 2
Ends up the DLL that was causing the problem was I believe a webservice/api URL for testing. Removing that corrected the issue on the 7.3.4 instance of DNN that they were using.

ssms tools pack unauthorized access exception

Just installed tools pack for ssms 2008
http://www.ssmstoolspack.com/Download
Keep seeing this on start up, most functions appear to work fine, just really annoying, cannot figure out what it's trying to do that is so bad, I'm running this as Administrator, still doesn't fix the error...
Exception Type:System.UnauthorizedAccessException
Error Messsage:
Attempted to perform an unauthorized operation.
Extra Data:
- Method: SSMSToolsPackC10.dll.WindowColoring.InitialLoadServersToSettings
Error StackTrace:
at System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType type, String name, SafeHandle handle, SecurityInfos securityInformation, SecurityIdentifier owner, SecurityIdentifier group, GenericAcl sacl, GenericAcl dacl)
at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, SafeHandle handle, AccessControlSections includeSections, Object exceptionContext)
at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, AccessControlSections includeSections, Object exceptionContext)
at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, AccessControlSections includeSections)
at System.Security.AccessControl.FileSystemSecurity.Persist(String fullPath)
at System.IO.File.SetAccessControl(String path, FileSecurity fileSecurity)
at System.Configuration.Internal.WriteFileContext.DuplicateTemplateAttributes(String source, String destination)
at System.Configuration.Internal.WriteFileContext.DuplicateFileAttributes(String source, String destination)
at System.Configuration.Internal.WriteFileContext.Complete(String filename, Boolean success)
at System.Configuration.Internal.InternalConfigHost.StaticWriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions)
at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions)
at System.Configuration.Internal.DelegatingConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions)
at System.Configuration.ClientSettingsStore.ClientSettingsConfigurationHost.WriteCompleted(String streamName, Boolean success, Object writeContext)
at System.Configuration.UpdateConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext)
at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
at System.Configuration.Configuration.SaveAsImpl(String filename, ConfigurationSaveMode saveMode, Boolean forceSaveAll)
at System.Configuration.Configuration.Save()
at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
at System.Configuration.SettingsBase.SaveCore()
at System.Configuration.SettingsBase.Save()
at System.Configuration.ApplicationSettingsBase.Save()
at p.e()
--------------- Filtered Assemblies ---------------
PostSharp
Full Name: PostSharp, Version=3.1.49.9, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7
File Path: C:\Program Files (x86)\SSMS Tools Pack\SSMS Tools Pack 2008\PostSharp.dll
File Version: 3.1.49.0
SSMSToolsPack10
Full Name: SSMSToolsPack10, Version=3.2.2.0, Culture=neutral, PublicKeyToken=a49c9b5533ef3445
File Path: C:\Program Files (x86)\SSMS Tools Pack\SSMS Tools Pack 2008\SSMSToolsPack10.dll
File Version: 3.2.2.0
SSMSToolsPackB10
Full Name: SSMSToolsPackB10, Version=3.2.2.0, Culture=neutral, PublicKeyToken=a49c9b5533ef3445
File Path: C:\Program Files (x86)\SSMS Tools Pack\SSMS Tools Pack 2008\SSMSToolsPackB10.dll
File Version: 3.2.2.0
SSMSToolsPackC10
Full Name: SSMSToolsPackC10, Version=3.2.2.0, Culture=neutral, PublicKeyToken=a49c9b5533ef3445
File Path: C:\Program Files (x86)\SSMS Tools Pack\SSMS Tools Pack 2008\SSMSToolsPackC10.dll
File Version: 3.2.2.0
This error indicates you don't have write permissions on the folder:
C:\Users\YourUserName\AppData\Local\Microsoft_Corporation\DefaultDomain_Path_LongAlphaNumericSequenceHere\10.50.xxxx.x\
And it can't save the settings.
As for the other stuff, email me through the website and we can talk further.

Code Access Security in Reporting Services 2008

I have a Delivery Extension running inside Reporting Service 2008.
It has been running fine for a long time. But now I want to make an insert into a database from within the extension.
First error I got, was this:
Exception: System.Security.SecurityException Exception Message: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Stacktrace: at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
Then I added this, before my code that opens the connection and does the insert:
SqlClientPermission sqlPermission = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
sqlPermission.Assert();
Then the error message changed to this:
Exception: System.Security.SecurityException Exception Message: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Stacktrace: at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 unrestrictedOverride, Int32 create)
at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Assert()
Then I added the following line:
SecurityPermission permission = new SecurityPermission(PermissionState.Unrestricted);
permission.Assert();
And now the error I get is this:
Exception: System.Security.SecurityException Exception Message: Stack walk modifier must be reverted before another modification of the same type can be performed. Stacktrace: at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Assert()
My code that contains the actual SqlConnection specific code is in an assembly referenced from the Delivery Extension. The Permission specific code was inside that assembly, but I tried moving it into the Delivery Extension assembly - but wothout any luck.
user407428 is correct, trying to enable two different modifiers is what is causing your problem. The best principle is to allow the permission for the part of the code that requires it, and then to disable the permission afterwords. So that when you need the next permission you can modify those rights again.
SqlClientPermission sqlClientPermission = new SqlClientPermission(PermissionState.Unrestricted);
sqlClientPermission.Assert();
//<your code that requires SqlClientPermission here>
CodeAccessPermission.RevertAccess();
SecurityPermission securityPermission = new SecurityPermission(PermissionState.Unrestricted);
securityPermission.Assert();
Some more things to take into account is that it is mostly not required to keep an object to the stack-walk, so the assert can be simplified to a single line, ei.
System.Security.Permissions.SecurityPermission(System.Security.Permissions.PermissionState.Unrestricted).Assert();
If you modified the stack-walk in a encapsulating method, the inner stack would probably not be able to modify the modifiers again. Ex.
public void UseSecurityPermission()
{
CodeAccessPermission.RevertAssert();
new System.Security.Permissions.SecurityPermission(System.Security.Permissions.PermissionState.Unrestricted).Assert();
<Some code that requires the SecurityPermission>
}
static void Main(string[] args)
{
new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted).Assert();
//< Some code that requires IOPermission>
UseSecurityPermission();
}
Even though UseSecurityPermission() reverts the stack-walk permission, it would not work, because the compiler can't get the security descriptor in the context.
Some further reading:
Programming with Stack-Walk Modifiers
At the point you are trying to modify the access permissions you may already have inherited it from higher level, or maybe you have done it somewhere before the point you are.
For example we have code like this:
SqlClientPermission sqlClientPermission = new SqlClientPermission(PermissionState.Unrestricted);
sqlClientPermission.Assert();
SecurityPermission securityPermission = new SecurityPermission(PermissionState.Unrestricted);
securityPermission.Assert();
We will have the exception like yours.

Resources