Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3877736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:31:56+00:00 2026-05-19T22:31:56+00:00

I have deployed WCF service on service on server and facing following exception. System.Security.SecurityException:

  • 0

I have deployed WCF service on service on server and facing following exception.

System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, 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.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +160
   System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility) +40
   NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateDynamicMethod(Type returnType, Type[] argumentTypes) +179
   NHibernate.Bytecode.Lightweight.ReflectionOptimizer.GenerateGetPropertyValuesMethod(IGetter[] getters) +326
   NHibernate.Bytecode.Lightweight.ReflectionOptimizer..ctor(Type mappedType, IGetter[] getters, ISetter[] setters) +150
   NHibernate.Bytecode.Lightweight.BytecodeProviderImpl.GetReflectionOptimizer(Type mappedClass, IGetter[] getters, ISetter[] setters) +62
   NHibernate.Tuple.Component.PocoComponentTuplizer..ctor(Component component) +367
   NHibernate.Tuple.Component.ComponentEntityModeToTuplizerMapping..ctor(Component component) +637
   NHibernate.Tuple.Component.ComponentMetamodel..ctor(Component component) +528
   NHibernate.Mapping.Component.BuildType() +65
   NHibernate.Mapping.Component.get_Type() +72
   NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping) +52
   NHibernate.Mapping.Property.IsValid(IMapping mapping) +56
   NHibernate.Mapping.PersistentClass.Validate(IMapping mapping) +139
   NHibernate.Mapping.RootClass.Validate(IMapping mapping) +45
   NHibernate.Cfg.Configuration.ValidateEntities() +241
   NHibernate.Cfg.Configuration.Validate() +30
   NHibernate.Cfg.Configuration.BuildSessionFactory() +61
   FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +49

Now I have applied below configuration and facing below problem:

<section name="hibernate-configuration" requirePermission="false" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
     <section name="activerecord" requirePermission="false" type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord"/>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
        <reflection-optimizer use="false" />
    </hibernate-configuration>

Stack Trace:

[SecurityException: That assembly does not allow partially trusted callers.]
   Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly, String strongAssemblyName, String strongModulePath, String weakAssemblyName, String weakModulePath) +0
   Castle.DynamicProxy.ModuleScope..ctor(Boolean savePhysicalAssembly) +35
   Castle.DynamicProxy.ProxyGenerator..ctor() +38
   NHibernate.ByteCode.Castle.ProxyFactory..cctor() +49
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:31:57+00:00Added an answer on May 19, 2026 at 10:31 pm

    Is your hosting provider only allowing you to run in medium trust? If so it means you can only reflect public members, I believe.

    Rick Strahl talks medium trust here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created and deployed the wcf service on server as a windows service,
We have a C# service that is deployed to a remote customer system. The
I have a WCF service deployed on production. I'm looking for a tool to
I have a WCF service deployed on two or more remote machines and there
I have a WCF Server Deployed through IIS. I want to Create a Certificate
I have a wcf service deployed on IIS with basicHttpBinding and aspNetCompatibilityEnabled=true I have
I have a WCF service deployed in a console app with BasicHTTPBinding and SSL
I have a WCF service deployed on another machine and I want to authenticate
We have a WCF service that is deployed to two servers. The bits are
We have a WCF service that needs to be deployed to 200 plus customers'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.