BizTalk WCF Adapter – BasicHttpBinding results in Partial Trust Exception

  • Sandro Pereira
  • Oct 10, 2010
  • 2 min read

One of the most cryptic errors you can encounter when consuming or exposing WCF services in BizTalk is the SecurityException. It usually looks like this:

Exception: System.ServiceModel.ServiceActivationException: The service ‘/MyService/Service.svc’ cannot be activated due to an exception during compilation. The exception message is: That assembly does not allow partially trusted callers.. —> System.Security.SecurityException: That assembly does not allow partially trusted callers.

📝 One-Minute Brief

When running BizTalk WCF adapters, you may encounter a SecurityException stating that the assembly does not allow partially trusted callers. This usually happens because the WCF runtime requires Full Trust to execute certain security or serialization operations. The solution involves ensuring the BizTalk Host Instance account has the necessary local administrative permissions or, more accurately, modifying the .config files or machine trust levels to allow the WCF stack to operate without security restrictions.

This error occurs when the WCF adapter attempts to perform an operation that requires Full Trust, but the environment or the BizTalk Host Instance is restricted by .NET Code Access Security (CAS).

Solution

After some research, I found that I’m getting this problem because the WCF service requires full-trust permission to run from the server. One way to solve the problem is:

  • Open the web.config file in Notepad
  • In <system.web> section add the following tag:
<trust level="Full" originUrl=""/>

For example:

<configuration>
   <system.web>
      <trust level="Full" originUrl="https://api.sandro-pereira.com/"/>
   </system.web>
</configuration>

These steps solved my problem.

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top