Profiling medium trust web applications

XPO Team Blog
29 August 2011

Our profiler uses WCF in order to communicate with the client application. One of the benefits of the XPOProfiler is that it supports 2 binding types. Both binding types have their advantages however in this situation only one allows us the flexibility we require.

NetTcpBinding

This option provides a secure and reliable binding environment for .Net to .Net cross machine communication. By default it creates a communication stack using WS-ReliableMessaging protocol, TCP for message delivery and windows security for message and authentication at run time.

image

One drawback is that in shared host environments there is no way to open a port neither to use Mutexes. Our second option allows us to overcome this by creating a WCF service and hosting it with our web application. 

WSHttpBinding

  • Defines a secure, reliable, interoperable binding suitable for non-duplex service contracts,
  • Supports WS-* functionality and distributed transactions with reliable and secure sessions using SOAP security,
  • Uses HTTP and HTTPS transport for communication,
  • Reliable sessions are disabled by default

image

We have already identified limitations when profiling medium trust web applications, now we must look at modifying our application in order to overcome them.

The first step is to add the new service using VS add new Item context menu.

image

This action will add the following items to the project;

  • IMyLogService.cs - the communication interface description,
  • MyLogService.svc.cs - the communication service class declaration

Furthermore the Web.config file will be modified by adding <system.serviceModel> section. I am using .NET3.5 right now, be aware that this step may vary according to the .NET version you are using.

The next step is to remove the IMyLogService.cs from the project.

image

Then we are going to modify the MyLogService.svc.cs as  follows;

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MyLogService : LogService {
    static LoggerBase logger = new LoggerBase(50000);
    static MyLogService() {
        LogManager.SetTransport(logger);
    }
    public MyLogService()
        : base(logger) {        
    }
}

The final step is to change the name of the communication contract in <system.serviceModel> section of Web.config file from WebApplicationToProfile.IMyLogService to DevExpress.Xpo.Logger.Transport.ILogSource.

image

After that we are ready to run the XPOProfiler and create a new connection to our medium hosted XPO web application.

image

Note: Version 11.2 will allow us to carry out all the above processes.

Happy profiling!

Related Links
Blog posts
Videos

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.