title: Accessing shared memory from WCF app running under VS2010 and IIS7 Express
body: <p>I'm developing a WCF app that needs to communicate with a custom Windows service through shared memory. My development environment is Windows 7 Professional with IIS7, IIS7 Express and Visual Studio 2010.</p>
  
  <p>When I run the app outside of VS2010 under full IIS7, it works great. But when I run the app from VS2010 using either IIS7 Express or the Development Web Server (Cassini), the app is unable to communicate with the Windows service. Using Process Explorer I've found that the shared memory in the Windows service has been assigned the names:</p>
  
  <pre><code>Section \BaseNamedObjects\NSBUS.q
  Section \BaseNamedObjects\NSBUS.b
  Section \BaseNamedObjects\NSBUS.a
  </code></pre>
  
  <p>while the WCF app is trying to access shared memory via the names:</p>
  
  <pre><code>Section \Sessions\1\BaseNamedObjects\NSBUS.q
  Section \Sessions\1\BaseNamedObjects\NSBUS.b
  Section \Sessions\1\BaseNamedObjects\NSBUS.a
  </code></pre>
  
  <p>The code to create/access the shared memory blocks is the same for both app and service (it's encapsulated in a DLL used by both). One difference that might be a factor: the service is set to run on the Local System account while I'm running the WCF app as my logon ID (which is a member of the Administrators group). I'm also guessing that maybe VS2010 is somehow injecting itself into the runtime/debugging environment in some way that forces the app to reference session-specific shared memory rather than true system global memory.</p>
  
  <p>Any suggestions on how I might be able to configure my environment so that the WCF app will use the same section names that are being used by the service? (BTW, the service creates the shared memory at boot time.)</p>