CCA From Remote Folder

Aug 22, 2011 at 12:35 PM

Hi all,

I developed a wpf application based on CCA for CRM 2011. Our customer would like to execute the application from a remote folder.
I changed the app.config to enable the remote load of our dll. So the CCA regularly starting but when it tries to open first tab I received this error:
System.Configuration.ConfigurationException: an error occured creating the configuration section handler for Microsoft.Uii/Common.Listeners: Request failed. I checked the security options on the Microsoft DLL but everything seems ok. Has someone had an idea to solve or work around this problem?
Thanks a lot

Massimiliano

Sep 15, 2011 at 7:38 PM

This is a problem with your .net Security Configuration
By Default, .net will not allow you to run Assemblies that require full trust from an untrusted source.

You use to be able to allow this with the CAS tool. Though that has now changed for .net 4..
http://msdn.microsoft.com/en-us/library/dd233103.aspx

http://msdn.microsoft.com/en-us/library/ee191569.aspx

I assume you are doing this to try to get around having to distribute updates to assemblies as you develop..

I would recommend that you use Click Once as the deployment system, that way the client will automatic check for updates to itself when it starts.

MattB-MSFT

May 14, 2013 at 8:40 AM
Edited May 14, 2013 at 9:17 AM
We have map drive (E:) and we want to run CCA over that map drive. But when we tried to run it, we get same error. Also we gave permission as below

APP.conf
...
<runtime>
<!-- enables legacy CAS policy for this process -->
<NetFx40_LegacySecurityPolicy enabled="true" />
<!-- Treat assemblies from network locations as fully trusted. -->
<!-- Caution: Do not point this loaded gun at your foot. -->
<loadFromRemoteSources enabled="true" />
</runtime>
</configuration>

CASPOL
C:\Windows\Microsoft.NET\Framework\v4.0.30319\caspol -m -ag 1 -url "file://E:\Nar\*" FullTrust
===================================================================

Microsoft Customer Care Accelerator

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for Microsoft.Uii/Common.Listeners: Request failed. (E:\Nar\Cca.AgentDesktop.exe.Config line 5) ---> System.Security.SecurityException: Request failed.
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.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type)
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)
--- 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 Microsoft.Uii.Common.Listeners.Configuration.ListenerConfiguration.GetConfig(String sectionName)
at Microsoft.Uii.Common.Logging.Logging.Initialize()
at Microsoft.Uii.Common.Logging.Logging.TryInitialize()
at Microsoft.Uii.Common.Logging.Logging.Information(String appName, String message)
at Cca.AgentDesktop.Program.Main() in Z:\workspaces\Vs1.0.0\Cca\AgentDesktop\Program.cs:line 54
May 17, 2013 at 11:56 AM
Edited May 17, 2013 at 11:59 AM
  1. Remove those lines from App.config
    <NetFx40_LegacySecurityPolicy enabled="true" />
    <loadFromRemoteSources enabled="true" />
  2. Install hotfix for .net 4
    http://support.microsoft.com/kb/2580188
and it works :)