Running [dbo].[StoredProcedure1].
A .NET Framework error occurred during execution of user-defined routine or aggregate "StoredProcedure1":
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.CredentialCache.get_DefaultCredentials()
at System.Web.Services.Protocols.WebClientProtocol.set_UseDefaultCredentials(Boolean value)
at CLRTest.Customer.CustCreate_Service.set_UseDefaultCredentials(Boolean value)
at CLRTest.Customer.CustCreate_Service..ctor()
at SP.StoredProcedure1()
using System; using System.Net; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using CLRTest.Customer; public partial class SP { [Microsoft.SqlServer.Server.SqlProcedure] public static void StoredProcedure1() { string login = "administrator"; string password = "Savita1"; string domain = "SSD"; CustCreate_Service Myservice = new CustCreate_Service(); CredentialCache mycred = new CredentialCache(); NetworkCredential netcred = new NetworkCredential(login,password,domain); mycred.Add(new Uri(Myservice.Url), "NTLM", netcred); Myservice.Credentials = mycred; CLRTest.Customer.CustCreate cust = new CLRTest.Customer.CustCreate() { No = "abc01" }; Myservice.Create(ref cust); } };
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
As I mentioned this is conceptual work so I have Windows Server 2008 R2 Enterprise with SQL Server 2008 R2 and NAV installation on the same machine.
The CustomSetting file in C:\Program Files (x86)\Microsoft Dynamics NAV\60\Service have the following element:
http://ssdynamics.co.in
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
http://ssdynamics.co.in