?
Solved

WCF Server Config - "Invalid or expired security context"

Posted on 2008-10-23
2
Medium Priority
?
9,078 Views
Last Modified: 2013-12-17
So, in my dev environment my tests to my local service works but when I deploy it - I get the following error on my unit tests (Automated build server spits this exception out).

"System.ServiceModel.FaultException : The message could not be processed. This is most likely because the action 'http://tempuri.org/IUserTasks/GetUsers' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding."

Dev env. is Vista w/  VS2008,
Published to  an XP IIS 5.1 box  with .net 3.5 sp1 installed.

The following are my config files and I am not sure if it is a config issue preventing this communication or if its my machine security.  I know I shouldn't need any certificates as I'm explicitly declaring no security for the service and client.  

Any Ideas?
Server Config -------
 
 <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WsHTTPBinding_IUserTasksBindingConfiguration"  closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                  allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="None" negotiateServiceCredential="false"
                establishSecurityContext="false" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service name="SwiftToDo.Services.UserTasksServiceType"  behaviorConfiguration="UserTasksServiceTypeBehaviour">
        <!-- Service Endpoints -->
        <endpoint address="" 
                  binding="wsHttpBinding" 
                  contract="SwiftToDo.Services.IUserTasks"
                  bindingConfiguration="WsHTTPBinding_IUserTasksBindingConfiguration">
        </endpoint>
      </service>
      
    </services>
    <behaviors>
      <serviceBehaviors>
        
        <behavior name="UserTasksServiceTypeBehaviour" >
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceTimeouts transactionTimeout="00:01:00"/>
          
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
 
 
 
 
 
Client------
 
 <system.serviceModel>
    <client>
      <endpoint address="http://brettlaptop/SwiftToDo/Service.svc" 
                   binding="wsHttpBinding"
                   bindingConfiguration="WsHTTPBinding_IUserTasksBindingConfiguration"
                   contract="SwiftToDo.Services.IUserTasks"
                   name="wsHttpBinding_IUserTasks"/>
 
    </client>
    <bindings>
      <wsHttpBinding>
        <binding name="WsHTTPBinding_IUserTasksBindingConfiguration"  closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                  allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="None" negotiateServiceCredential="false"
                establishSecurityContext="false" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>

Open in new window

0
Comment
Question by:bswiftly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
DarrenD earned 500 total points
ID: 22868715
Hi,

I'm not 100% but your bindings look a little messed up. My bindings look like the following:

-- Client

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IAccounting" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="10000000" maxBufferPoolSize="524288" maxReceivedMessageSize="10000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="200000" maxArrayLength="200000"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:3332/Accounting.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IAccounting" contract="AccountingSVC.IAccounting"
        name="BasicHttpBinding_IAccounting" />
  </system.serviceModel>


-- Server

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="Usit.Services.AccountingBehavior"
        name="Usit.Services.Accounting">
        <endpoint address="" binding="basicHttpBinding" contract="Usit.Services.IAccounting">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Usit.Services.AccountingBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>    
  </system.serviceModel>

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question