2012-05-18 3 views
1

En utilisant VS 2010 MVC3, j'ai configuré le fichier web.config pour me connecter à ma base de données distante. Quand je débogue ses courses ok, enregistre, se connecte bien. Mais quand je le télécharger à l'hôte que je reçois cette erreur:Exception de sécurité sur le framework .NET asp 4 utilisant MySQL, niveau de confiance: Moyen

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.Security.Permissions.SecurityPermission, mscorlib, Version=4.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.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
MySql.Data.MySqlClient.MySqlConnectionStringBuilder.CreatePermissionSet() +0 MySql.Data.MySqlClient.MySqlConnectionStringBuilder.DemandPermissions() +38 MySql.Data.MySqlClient.MySqlConnection.PermissionDemand() +94 MySql.Data.MySqlClient.MySqlConnection.Open() +196
MySql.Web.Common.SchemaManager.GetSchemaVersion(String connectionString) +65
MySql.Web.Common.SchemaManager.CheckSchema(String connectionString, NameValueCollection config) +39
MySql.Web.Security.MySQLRoleProvider.Initialize(String name, NameValueCollection config) +462
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +419

Im en utilisant MySQL Connector Net 6.5.4

+0

Que diriez-vous du problème [System.Security.Permissions.SecurityPermission, mscorlib] (http://forums.codeguru.com/showthread.php?t=449172). Semble être le même problème en raison des autorisations sur les niveaux de confiance dans l'hôte. Est-ce un hôte partagé? – matthewnreid

+0

Oui tristement C'est –

+0

Avez-vous résolu ceci? – rcdmk

Répondre

0

thats un problème commun qui a beaucoup de gens having.Thats parce que vous construire votre site Web Niveau de confiance totale.Cela vous permet de faire presque tout par IIS.Mais beaucoup de société d'hébergement permet juste niveau de confiance moyen.Alors vous avez besoin de recoder les parties nécessaires de votre projet sous le niveau de confiance moyen.

Ouvert;

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

dossier et d'ouvrir le fichier webconfig, et de modifier la ligne;

<trust level="Full" originUrl="" /> 

à

<trust level="Medium" originUrl="" /> 

Honnêtement, je n'ai pas une connaissance approfondie au sujet de plus loin et votre assemblies.So je peux aider beaucoup.

Questions connexes