I am getting the following error when trying to setup Peer to Peer Replication.
Warning: The distribution agent job has been implicitly created and will run under the SQL Server Agent Service Account.
Msg 6522, Level 16, State 1, Procedure sp_MSgeneratenosyncsubscriptionsetupscript_sqlclr, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "sp_MSgeneratenosyncsubscriptionsetupscript_sqlclr":
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. --->
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.MethodAccessException: Attempt by method 'System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)'
to access method 'System.Diagnostics.SwitchElementsCollection..ctor()' failed. ---> System.Security.SecurityException: Request failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.PermissionListSet.CheckSetDemandWithModification(PermissionSet pset, PermissionSet& alteredDemandSet, RuntimeMethodHandleInternal rmh)
at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandleInternal rmh)
at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet g
...
System.TypeInitializationException:
at System.Data.SqlClient.SqlConnection..ctor()
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
at Microsoft.SqlServer.Replication.TransSqlClrCodeGenerators.GatherMetadataAndGenerateScript()
at Microsoft.SqlServer.Replication.TransSqlClrCodeGenerators.sp_MSgeneratenosyncsubscriptionsetupscript_sqlc...
The Subscriber was dropped.
Msg 21678, Level 16, State 1, Procedure sp_MSrepl_addpushsubscription_agent, Line 194
The parameter "@job_password" can be set to "NULL" only when "@job_login" is set to "NULL".
This only occurs when selecting "Push" for the delivery. If I select Pull it creates without errors.
Any help would be appreciated.
Thanks,
Dean Whitlock