UnityVS error on importing? - unityvs

I have imported UnityVS 2.1 in my Unity 5.1.1f1 Personal.. and as soon as I import I get the following error.
DirectoryNotFoundException: Could not find a part of the path
"C:\Users\Public\Documents\Unity Projects\Achievement
system\Library\UnityAssemblies\version.txt".
System.IO.FileStream..ctor (System.String path, FileMode mode,
FileAccess access, FileShare share, Int32 bufferSize, Boolean
anonymous, FileOptions options) (at
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/FileStream.cs:292)
System.IO.FileStream..ctor (System.String path, FileMode mode,
FileAccess access, FileShare share) (wrapper
remoting-invoke-with-check) System.IO.FileStream:.ctor
(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append,
System.Text.Encoding encoding, Int32 bufferSize) (at
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path, Boolean append)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor
(string,bool) System.IO.File.CreateText (System.String path) (at
/Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/File.cs:159)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.CreateVersionFile
(System.String[] assemblies)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.DeployUnityAssemblies
(SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolution
solution)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject
()
SyntaxTree.VisualStudio.Unity.Bridge.Project+<>c__DisplayClass4.b__3
() UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at
C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:264)
Can anyone tell me what is the problem?
I am using VS2015 community edition.

Ok I have solved the problem... it seems like the UnityVS didnt create the folder structure as follows by itself
\Library\UnityAssemblies\version.txt
So I created it manually by creating the UnityAssemblies folder and a blank text file named version.txt inside it... and bam it worked perfectly..
Stupid UnityVS... had me worrying for 1 hour.

This happens when your project has no scripts and wasnt started at least 1 time, only then that folder and file is created

Related

Opening Office Application Error: Microsoft.Office.Interop.Excel / Microsoft.Office.Interop.Word

I am hoping that someone can give a little insight and/or instance.
I am experiencing an error trying to create an instance of an Excel or Word application. The application I am working on is using interop assemblies to manipulate Excel and Word. In both cases, I have been successful in doing so in the past, the problems/errors began only recently. I've noticed multiple posts about similar error messages and have looked through them, but none addressed a similar issue or provided relevant insights.
In attempting to create an instance of Excel, the resulting error is similar to the following:
{System.Runtime.InteropServices.COMException (0x80080005): Retrieving
the COM class factory for component with CLSID
{00024500-0000-0000-C000-000000000046} failed due to the following
error: 80080005 Server execution failed (Exception from HRESULT:
0x80080005 (CO_E_SERVER_EXEC_FAILURE)). at
System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType
objectType) at
System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType
serverType) at
System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType
serverType, Object[] props, Boolean bNewObj) 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, StackCrawlMark& stackMark) at
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at
System.Activator.CreateInstance(Type type)
I am encountering a similar error when trying to create an instance of Word. Again, my code has been doing this with no problem, until recently.
I'm thinking this may have started with possibly with recent upgrades to the Office instance on my development machine.
The references for both Interop assemblies (Microsoft.Office.Interop.Excel and Microsoft.Office.Interop.Word) associated with my project have Embed Interop Types set to TRUE)
If I am interpreting the error text correctly, the code is looking for the typelib/class id (i.e., {00024500-0000-0000-C000-000000000046}) to be in the current machine's registry and cannot find it. I did search the \HKEY_CLASSES_ROOT\TypeLib folder in the registry and did not see it. My question would be, why is it looking for that particular id? Of course, I may be completely out in left field on this line of reasoning.
Since I am seeing similar effects in both contexts, I have to believe that the issue's cause here is on the Office level, rather than either application. To the best of my knowledge, no change was made to the code or the Interop assembly references in the project.
Any insights and/or suggestions would, of course, be greatly appreciated.
I am using VS 2017 (64-bit) on Windows 10.

Error message after rebuild index

I have a content type consiting out of two fields "First" and "Second". Then I said "Include in Index". After going to the settings and clicking "Rebuild Index" the following message occurs:
(I am using SQL Express with Orchard 1.8.1)
Oops. Something went wrong ... sorry
An unhandled exception has occurred and the request was terminated.
Please refresh the page. If the error persists, go back Access to the
path 'segments.gen' is denied. System.UnauthorizedAccessException:
Access to the path 'segments.gen' is denied. at
System.IO.Directory.DeleteHelper(String fullPath, String userPath,
Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound) at
System.IO.Directory.Delete(String fullPath, String userPath, Boolean
recursive, Boolean checkHost) at
Orchard.Indexing.Services.IndexingTaskExecutor.DeleteIndex(String
indexName) at
Orchard.Indexing.Services.IndexingTaskExecutor.RebuildIndex(String
indexName) at
Orchard.Indexing.Services.IndexingService.RebuildIndex(String
indexName) at
Orchard.Indexing.Controllers.AdminController.Rebuild(String id) at
lambda_method(Closure , ControllerBase , Object[] ) at
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters) at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary2
parameters) at
System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult
asyncResult, ActionInvocation innerInvokeState) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult
asyncResult) at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3f()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.b__41()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.b__41()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass48.b__41()
The search settings page is empty now:
After changing the folder permissions for Orchard.Web\App_Data\Sites\Default\Indexes\Search and C:\inetpub\wwwroot\Orchard1\App_Data\Sites\Default it worked. I have to installations one on my development and the other on the test machine. So when I setup everything in Visual Studio somethimes folder permissions are not yet correct after publishing to the other system. I just changed IIS_IUSRS to have full access to these folders.

Orchard 1.8 Getting 404 Not Found Error - Deployed via Web Matrix

I created an Orchard Website (Version 1.8)
It was created through WebMatrix.
Locally everything runs perfectly fine.
When I upload it to my server (Web Deploy also via WebMatrix) I get following Error Message:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /
Orchard Error Logs:
2014-05-13 08:22:07,827 [23] Orchard.Environment.DefaultOrchardHost - (null) - A tenant could not be started: Default
NHibernate.HibernateException: Could not create the driver from Orchard.Data.Providers.SqlCeDataServicesProvider+OrchardSqlServerCeDriver, Orchard.Framework, Version=1.8.0.0, Culture=neutral, PublicKeyToken=null. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.Data.SqlServerCe.UnmanagedLibraryHelper..ctor(String fileName)
at System.Data.SqlServerCe.NativeMethodsHelper..ctor(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinariesFromPrivateFolder(String privateInstall)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
at System.Data.SqlServerCe.SqlCeCommand..ctor()
--- End of inner exception stack trace ---
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, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Bytecode\ActivatorObjectsFactory.cs:line 9
at NHibernate.Driver.ReflectionDriveConnectionCommandProvider.CreateCommand() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Driver\ReflectionDriveConnectionCommandProvider.cs:line 35
at NHibernate.Driver.ReflectionBasedDriver.CreateCommand() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Driver\ReflectionBasedDriver.cs:line 65
at NHibernate.Driver.SqlServerCeDriver.Configure(IDictionary`2 settings) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Driver\SqlServerCeDriver.cs:line 35
at Orchard.Data.Providers.SqlCeDataServicesProvider.OrchardSqlServerCeDriver.Configure(IDictionary`2 settings) in c:\Orchard\src\Orchard\Data\Providers\SqlCeDataServicesProvider.cs:line 78
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Connection\ConnectionProvider.cs:line 109
--- End of inner exception stack trace ---
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Connection\ConnectionProvider.cs:line 113
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Connection\ConnectionProvider.cs:line 64
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Connection\ConnectionProviderFactory.cs:line 50
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Cfg\SettingsFactory.cs:line 83
at NHibernate.Cfg.Configuration.BuildSettings() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Cfg\Configuration.cs:line 1733
at NHibernate.Cfg.Configuration.BuildSessionFactory() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Cfg\Configuration.cs:line 1264
at Orchard.Data.SessionFactoryHolder.BuildSessionFactory() in c:\Orchard\src\Orchard\Data\SessionFactoryHolder.cs:line 90
at Orchard.Data.SessionFactoryHolder.GetSessionFactory() in c:\Orchard\src\Orchard\Data\SessionFactoryHolder.cs:line 68
at Orchard.Data.SessionLocator.EnsureSession() in c:\Orchard\src\Orchard\Data\SessionLocator.cs:line 117
at Orchard.Data.SessionLocator.Demand() in c:\Orchard\src\Orchard\Data\SessionLocator.cs:line 42
at Orchard.Data.SessionLocator.For(Type entityType) in c:\Orchard\src\Orchard\Data\SessionLocator.cs:line 36
at Orchard.Data.Repository`1.get_Session() in c:\Orchard\src\Orchard\Data\Repository.cs:line 26
at Orchard.Data.Repository`1.get_Table() in c:\Orchard\src\Orchard\Data\Repository.cs:line 30
at Orchard.Data.Repository`1.Fetch(Expression`1 predicate) in c:\Orchard\src\Orchard\Data\Repository.cs:line 126
at Orchard.Data.Repository`1.Get(Expression`1 predicate) in c:\Orchard\src\Orchard\Data\Repository.cs:line 91
at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Get(Expression`1 predicate) in c:\Orchard\src\Orchard\Data\Repository.cs:line 60
at Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetDescriptorRecord() in c:\Orchard\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:line 57
at Orchard.Core.Settings.Descriptor.ShellDescriptorManager.GetShellDescriptor() in c:\Orchard\src\Orchard.Web\Core\Settings\Descriptor\ShellDescriptorManager.cs:line 30
at Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings settings) in c:\Orchard\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:line 66
at Orchard.Environment.DefaultOrchardHost.CreateShellContext(ShellSettings
I googled a bit and most posts suggested
Check Read/Write Permissions on Default .NET AppPool user for the folders "App_Data, Modules, Media, Themes".
I checked the permissions and set them this way.
Still get the excact same error though.
Any suggestions? Help would be highly appreciated.
Edit:
Solved it myself, see the seconds post...
Another possible solution is to verify DB connectivity. In my case, I tried the above solutions and it still was returning the same 404 error message. In the Orchard/App_Data/logs, it showed an error that was more related to the database, along the same lines as "Could not create the driver from Orchard.Data.Providers.SqlCeDataServicesProvider+OrchardSqlServerCeDriver" in the OP error message.
I realized I hadn't set the security group permissions on the RDS instance at AWS hosting to properly allow the webserver EC2 instance access to the database. Once I added the appropriate EC2 instance (security group the EC2 instances are part of actually, not just the machine), I was able to access the site without further issue.
The folder permissions are also critical, but if you try that and still not having luck, verify your database permissions are correct too!
I've had this issue before and this fixed it for me:
Right click on AppData and select properties
Select the Security tab, click edit and then Add a new username
Add "IIS AppPool\InsertAppPoolNameHere"
Solved it myself.
It seems I had to add full permissions to every single folder in Orchard Root (even Core, Config, bin etc...) not only the mentioned 4 ones.
If you googled yourself and you stumble accross this try that out.
I'm currently removing some of the permissions again step-by-step to check for how long it works, and what the minimum required really is.
But thank you Hazza for your help, really appreciated that.
Go to src->Orchard.Web Folder and right click properties and
select security tab.
Click on edit -> Add -> Advanced from the popped "Select Users or
Groups" window.
Then click on Find Now to search for available users and after
list of users been generated add "IIS_IUSRS" then OK.
Give IIS_IUSRS permissions to modify.
Done.

Localization with Storyboard - error when moving storyboards to Base folder

I am trying to follow the tutorial posted on the Blog on how to localize with Storyboards
http://blog.xamarin.com/howto-localize-ios-storyboards-monotouch/
When I create the folder Base.lproj and move the storyboard, the app stops working and I get the following error when I run it:
MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: There doesn't seem to be a valid compiled storyboard at path '/Users/daniel/Library/Application Support/iPhone Simulator/6.1/Applications/62404087-7F41-4A27-ADBD-4A0010BDD5C8/TestingApp.app/MainStoryboard_iPhone_Checklist.storyboardc' at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 at TestingApp.Application.Main (System.String[] args) [0x00000] in /Users/daniel/Documents/github/TestingApp/TestingApp/iOS/TestingApp/TestingApp/Main.cs:17
(when the storyboard is on the root of the project, the project works fine)
Does anybody knows how to fix this?
Thanks
So here is my solution/workaround.
Instead of setting up the storyboard on the settings, I get it on the AppDelagate like this:
UIStoryboard storyboard = UIStoryboard.FromName ("Base.lproj/MainStoryboard_iPhone_Checklist", null);
That way I dont get the exception and Localization works fine.

How do I make my application run in Full Trust mode - .NET 4.0 Console Application

We are having an issue with a command line (batch) application and full/partial trust.
Our previous release (version number 7.13.0.63) works fine, however, when we install the new version (7.13.0.249) we get a “That assembly does not allow partially trusted callers.”
Exception:
Stack Trace (edited):
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[T]()
at <Company>.Service.<Product>.Proxy.Factories.ControllerProxyFactory.Create[T]()
<Stack Trace that leads to creation of a WCF client> ...
Inner Exception:
An error occurred creating the configuration section handler for system.serviceModel/behaviors: That assembly does not allow partially trusted callers. (C:\Program Files (x86)\InsuranceLine\ListLoader\InsuranceLine.ListLoader.Launcher.exe.Config line 53)
Stack Trace:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecordsectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
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.ServiceModel.Activation.AspNetEnvironment.UnsafeGetSectionFromConfigurationManager(String sectionPath)
at System.ServiceModel.Activation.AspNetEnvironment.UnsafeGetConfigurationSection(String sectionPath)
at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext, String sectionPath)
at System.ServiceModel.Description.ConfigLoader.LookupChannel(ContextInformation configurationContext, String configurationName, ContractDescription contract, EndpointAddress address, Boolean wildcard, Boolean useChannelElementKind, ServiceEndpoint& serviceEndpoint)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
<Stack Trace that determines the correct WCF factory to create>
Inner Exception:
That assembly does not allow partially trusted callers.
Stack Trace:
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
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 System.ServiceModel.Configuration.ServiceModelExtensionCollectionElement`1.CreateNewSection(String name)
at System.ServiceModel.Configuration.ServiceModelExtensionCollectionElement`1.DeserializeElementCore(XmlReader reader)
at System.ServiceModel.Configuration.ServiceModelExtensionCollectionElement`1.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
at System.Configuration.ConfigurationElementCollection.OnDeserializeUnrecognizedElement(String elementName, XmlReader reader)
at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
at System.Configuration.ConfigurationSection.DeserializeSection(XmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
In regards to the process that we use to deploy our product, we use a MSI created through WiX. We perform the following steps:
Uninstall the previous version of the product
Copy the msi from a network share (same share for both versions, different subdirectory based on versions)
Install the msi as an administrator
This installs to C:\Program Files (x86)
The only changes between the 2 versions are:
The inclusion of an extra AppSettings item in the app.config file (myapp.exe.config) to specify a transaction timeout
Changing a “using new TransactionScope()” to “using New TransactionScope(TransactionScopeOption.Required, timeoutValueReadFromAppSettingsAndStoredInLocalVariable)”
The creation of the WCF client is outside of this Transaction Scope.
Additional Information:
The exception does not occur in any of our dev/staging/qa/pre production environments. It only happens on our production application server.
We are in the process of rolling out Windows 7 to our organisation, so it is possible that enterprise policy has changed.
The application targets the .Net Framework 4.0
If we uninstall the new version, and reinstall the old version (including the copy from network share) the old version works fine still
The machine being installed to is Windows Server 2008 R2
The machine is a Virtual Machine that is hosted in a VMWare environment
Ideally I’d like to know a few things:
How to alter the assembly (or set permissions after install) so that it can run in a full trust mode
How to replicate the issue in dev/staging/QA environments
Explicitly "untrusting" the assembly might reproduce it, but I want to reproduce it in the same way as production so that when it is installed it is identified as untrusted, it seems to me that the way to do this would have something to do with “untrusting” the network share I copy the MSI from, or possibly “untrusting” the publisher information in the MSI/assembly.
How to configure the production application server/security policy so that future installs are fully trusted (Answering item 2 will most likely answer this)
Thanks
This is really quite odd given that the .NET 4.0 CLR does not apply CAS security policy by default, so you would actually have to make a some sort of (hopefully) deliberate change to get a locally installed command line application to be partially trusted.
Before trying to dig too deep for potential causes, could you please verify the following:
Does your app.config file contain a NetFx40_LegacySecurityPolicy element?
Is your application actually running under the 4.0 CLR on the problem machine? (If you can't modify the source to output the value of Environment.Version before the exception is thrown, Process Explorer should allow you to determine which CLR version(s) are running in your process.)

Resources