Click here to Skip to main content
15,899,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I am using the ASP.NET,c#.NET.using mysql as database ,trying to connect the Database by using the Mysql connector, upto now every thing is fine and In localhost it was working fine , Username and passwords of Mysql was Correct.

But creating problem after the uploading the Webapplication to godaddy server. When i am using,Passing through the statement like the con.open(), then i am getting the error like

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[SecurityException: Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +58
   System.Net.Dns.GetHostEntry(String hostNameOrAddress) +71
   MySql.Data.Common.StreamCreator.GetDnsHostEntry(String hostname) +69
   MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) +491
   MySql.Data.MySqlClient.NativeDriver.Open() +243


I had tried a lot by using the <trust level="High" originurl="">,
<trust level="Full" originurl=""> It was not solved

can any please Solve This,
Thanks in Advance
Posted
Updated 27-Sep-12 23:35pm
v3
Comments
Kiran Susarla 28-Sep-12 5:41am    
Are the webserver and Database server in the same network? And are they able to communicate with each other (not through the code)? Please check these.
[no name] 28-Sep-12 5:43am    
Yes with in the same hosting
It was Communicating , i think it was the execuption of security, i am not getting any idea about to solve this issue
Thanks for replay

1 solution

If you see this message it means you need to create your assembly with either EXTERNAL_ACCESS or UNSAFE as the PERMISSION_SET value. Before you can create an assembly with EXTERNAL_ACCESS or UNSAFE two conditions must exist:

1. Database must be marked as TRUSTWORTHY by an administrator (member of sysadmin fixed server role) or the assembly has been signed with a certificate or asymmetric key
2. User creating the assembly must have EXTERNAL ACCESS ASSEMBLY or UNSAFE ASSEMBLY permissions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900