copyPasteGhost
asked on
WCF IIS ProtocolException
I have a WCF Service hosted on a win 2K3 server. .NET 3.5 is installed on the server as well as the windows server 2008 SDK for .NET 3.5.
I am able to see the service through VS 2008 when I right click to add a service reference. That part is all good and dandy and even my intellisense is working perfectly. The problem I'm having is when I run the web application and try to call the wCF service. I'm getting this error.
System.ServiceModel.Securi ty.Securit yNegotiati onExceptio n was unhandled by user code
Message="The caller was not authenticated by the service."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Securi ty.Issuanc eTokenProv iderBase`1 .DoNegotia tion(TimeS pan timeout)
at System.ServiceModel.Securi ty.SspiNeg otiationTo kenProvide r.OnOpen(T imeSpan timeout)
at System.ServiceModel.Securi ty.Wrapper SecurityCo mmunicatio nObject.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Securi ty.Communi cationObje ctSecurity TokenProvi der.Open(T imeSpan timeout)
at System.ServiceModel.Securi ty.Securit yUtils.Ope nTokenProv iderIfRequ ired(Secur ityTokenPr ovider tokenProvider, TimeSpan timeout)
at System.ServiceModel.Securi ty.Symmetr icSecurity Protocol.O nOpen(Time Span timeout)
at System.ServiceModel.Securi ty.Wrapper SecurityCo mmunicatio nObject.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Securit yChannelFa ctory`1.Cl ientSecuri tyChannel` 1.OnOpen(T imeSpan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Securi ty.Securit ySessionSe curityToke nProvider. DoOperatio n(Security SessionOpe ration operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
at System.ServiceModel.Securi ty.Securit ySessionSe curityToke nProvider. GetTokenCo re(TimeSpa n timeout)
at System.IdentityModel.Selec tors.Secur ityTokenPr ovider.Get Token(Time Span timeout)
at System.ServiceModel.Securi ty.Securit ySessionCl ientSettin gs`1.Clien tSecurityS essionChan nel.OnOpen (TimeSpan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca llOpenOnce .System.Se rviceModel .Channels. ServiceCha nnel.ICall Once.Call( ServiceCha nnel channel, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca llOnceMana ger.CallOn ce(TimeSpa n timeout, CallOnceManager cascade)
at System.ServiceModel.Channe ls.Service Channel.En sureOpened (TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channe ls.Service ChannelPro xy.InvokeS ervice(IMe thodCallMe ssage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channe ls.Service ChannelPro xy.Invoke( IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr oxies.Real Proxy.Hand leReturnMe ssage(IMes sage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Pr oxies.Real Proxy.Priv ateInvoke( MessageDat a& msgData, Int32 type)
at ServiceReference1.IService 1.GetDataU singDataCo ntract(Com positeType composite, String key)
at ServiceReference1.Service1 Client.Get DataUsingD ataContrac t(Composit eType composite, String key) in d:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\orderwcftest\f384daf 1\a4aca58d \App_WebRe ferences.u ahcqvgq.1. cs:line 122
at _Default.btnHitService_Cli ck(Object sender, EventArgs e) in d:\Inetpub\wwwroot\OrderWC FTest\Defa ult.aspx.c s:line 16
at System.Web.UI.WebControls. Button.OnC lick(Event Args e)
at System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument)
at System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData)
at System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt)
InnerException: System.ServiceModel.FaultE xception
Message="The request for security token could not be satisfied because authentication failed."
Source="System.ServiceMode l"
Action="http://www.w3.org/2005/08/addressing/soap/fault"
StackTrace:
at System.ServiceModel.Securi ty.Securit yUtils.Thr owIfNegoti ationFault (Message message, EndpointAddress target)
at System.ServiceModel.Securi ty.SspiNeg otiationTo kenProvide r.GetNextO utgoingMes sageBody(M essage incomingMessage, SspiNegotiationTokenProvid erState sspiState)
InnerException:
I did some research and I came across a post saying that if you change your web.config of the asp.net application from:
<reliableSession ordered="true" inactivityTimeout="00:10:0 0"
enabled="False" />
<security mode="Message">
to
<reliableSession ordered="true" inactivityTimeout="00:10:0 0"
enabled="true" />
<security mode="None">
it should solve that problem. So I did that and now when I try to hit the WCF service I'm getting this error.
System.ServiceModel.Protoc olExceptio n was unhandled by user code
Message="The remote endpoint has sent an unrecognized fault with namespace, http://www.w3.org/2003/05/soap-envelope, name Sender, and reason The message could not be processed. This is most likely because the action 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence' 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.. The channel could not be opened."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe ls.ClientR eliableSes sion.Proce ssCreateSe quenceResp onse(Messa ge response, DateTime start)
at System.ServiceModel.Channe ls.ClientR eliableSes sion.Open( TimeSpan timeout)
at System.ServiceModel.Channe ls.Reliabl eRequestSe ssionChann el.OnOpen( TimeSpan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca llOpenOnce .System.Se rviceModel .Channels. ServiceCha nnel.ICall Once.Call( ServiceCha nnel channel, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca llOnceMana ger.CallOn ce(TimeSpa n timeout, CallOnceManager cascade)
at System.ServiceModel.Channe ls.Service Channel.En sureOpened (TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channe ls.Service ChannelPro xy.InvokeS ervice(IMe thodCallMe ssage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channe ls.Service ChannelPro xy.Invoke( IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr oxies.Real Proxy.Hand leReturnMe ssage(IMes sage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Pr oxies.Real Proxy.Priv ateInvoke( MessageDat a& msgData, Int32 type)
at ServiceReference1.IService 1.GetDataU singDataCo ntract(Com positeType composite, String key)
at ServiceReference1.Service1 Client.Get DataUsingD ataContrac t(Composit eType composite, String key) in d:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\orderwcftest\f384daf 1\a4aca58d \App_WebRe ferences.u ahcqvgq.1. cs:line 122
at _Default.btnHitService_Cli ck(Object sender, EventArgs e) in d:\Inetpub\wwwroot\OrderWC FTest\Defa ult.aspx.c s:line 16
at System.Web.UI.WebControls. Button.OnC lick(Event Args e)
at System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument)
at System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData)
at System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt)
InnerException:
I've tried to find out why, and came up empty.
Any help would be AWESOME!!!!
Thanks,
Ghost
I am able to see the service through VS 2008 when I right click to add a service reference. That part is all good and dandy and even my intellisense is working perfectly. The problem I'm having is when I run the web application and try to call the wCF service. I'm getting this error.
System.ServiceModel.Securi
Message="The caller was not authenticated by the service."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Channe
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.IdentityModel.Selec
at System.ServiceModel.Securi
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at ServiceReference1.IService
at ServiceReference1.Service1
at _Default.btnHitService_Cli
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException: System.ServiceModel.FaultE
Message="The request for security token could not be satisfied because authentication failed."
Source="System.ServiceMode
Action="http://www.w3.org/2005/08/addressing/soap/fault"
StackTrace:
at System.ServiceModel.Securi
at System.ServiceModel.Securi
InnerException:
I did some research and I came across a post saying that if you change your web.config of the asp.net application from:
<reliableSession ordered="true" inactivityTimeout="00:10:0
enabled="False" />
<security mode="Message">
to
<reliableSession ordered="true" inactivityTimeout="00:10:0
enabled="true" />
<security mode="None">
it should solve that problem. So I did that and now when I try to hit the WCF service I'm getting this error.
System.ServiceModel.Protoc
Message="The remote endpoint has sent an unrecognized fault with namespace, http://www.w3.org/2003/05/soap-envelope, name Sender, and reason The message could not be processed. This is most likely because the action 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence' 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.. The channel could not be opened."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at ServiceReference1.IService
at ServiceReference1.Service1
at _Default.btnHitService_Cli
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException:
I've tried to find out why, and came up empty.
Any help would be AWESOME!!!!
Thanks,
Ghost
Please make sure you define a namespace for the service contract.
<ServiceContract(Namespace :="http://ExpertsExchange.Answers.ServiceContracts/2009/02", Name:="MyServiceContract", SessionMode:=SessionMode.A llowed)> _
Then use this namespace as bindingNamespace in service endpoints in both web.config files.
<endpoint name="Basic_HttpBinding_My Contract" address="" binding="basicHttpBinding"
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="MyServiceContrac ts">
</endpoint>
<ServiceContract(Namespace
Then use this namespace as bindingNamespace in service endpoints in both web.config files.
<endpoint name="Basic_HttpBinding_My
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="MyServiceContrac
</endpoint>
ASKER
Does the namespace of the servicecontract have to be the namespace of the class?
Ex.
namespace OrderWCF {
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract]
public interface IService1 {
}
}
Does the namespace have to be OrderWFC?
Also. >>Please make sure you define a namespace for the service contract.
Where do I put that?
>>
Then use this namespace as bindingNamespace in service endpoints in both web.config files.
In the web.config of the service:
<services>
<service name="OrderWCF.Service1" behaviorConfiguration="Ord erWCF.Serv ice1Behavi or">
<!-- Service Endpoints -->
<endpoint bindingNamespace="ENTER IN NAMESPACE" address="" binding="wsHttpBinding" contract="OrderWCF.IServic e1" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchang e"/>
</service>
</services>
In the Web.config of my localhost website.
<endpoint address="http://admin.testserver.ca/OrderWCF/Service1.svc"
binding="wsHttpBinding" bindingNamespace="ENTER IN NAMESPACE" bindingConfiguration="WSHt tpBinding_ IService1"
contract="ServiceReference 1.IService 1" name="WSHttpBinding_IServi ce1">
Is this right?
Ex.
namespace OrderWCF {
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract]
public interface IService1 {
}
}
Does the namespace have to be OrderWFC?
Also. >>Please make sure you define a namespace for the service contract.
Where do I put that?
>>
Then use this namespace as bindingNamespace in service endpoints in both web.config files.
In the web.config of the service:
<services>
<service name="OrderWCF.Service1" behaviorConfiguration="Ord
<!-- Service Endpoints -->
<endpoint bindingNamespace="ENTER IN NAMESPACE" address="" binding="wsHttpBinding" contract="OrderWCF.IServic
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchang
</service>
</services>
In the Web.config of my localhost website.
<endpoint address="http://admin.testserver.ca/OrderWCF/Service1.svc"
binding="wsHttpBinding" bindingNamespace="ENTER IN NAMESPACE" bindingConfiguration="WSHt
contract="ServiceReference
Is this right?
Does the namespace of the servicecontract have to be the namespace of the class?
No need where class namespace can be EE.Answers.WCF, but service contract namespace can be "http://ExpertsExchange.Answers.ServiceContracts/2009/02".
Does the namespace have to be OrderWFC?
No need, you can have any namespace defined in the service contract and it must be the same in service configuration in web.config as below.
<endpoint name="Basic_HttpBinding_My Contract" address="" binding="basicHttpBinding"
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="MyServiceContrac ts">
</endpoint>
Also. >>Please make sure you define a namespace for the service contract.
Where do I put that?
You define the ServiceContract in your class.
eg. [ServiceContract]
public interface IService1
No need where class namespace can be EE.Answers.WCF, but service contract namespace can be "http://ExpertsExchange.Answers.ServiceContracts/2009/02".
Does the namespace have to be OrderWFC?
No need, you can have any namespace defined in the service contract and it must be the same in service configuration in web.config as below.
<endpoint name="Basic_HttpBinding_My
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="MyServiceContrac
</endpoint>
Also. >>Please make sure you define a namespace for the service contract.
Where do I put that?
You define the ServiceContract in your class.
eg. [ServiceContract]
public interface IService1
ASKER
Here is the web.config for my Service
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="Ord erWCF.Serv ice1Behavi or" name="OrderWCF.Service1">
<clear />
<endpoint address="" binding="wsHttpBinding" name="OrderService"
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="OrderWCF.IServic e1" listenUriMode="Explicit">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchang e"
listenUriMode="Explicit">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="OrderWCF.Service1Beh avior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFa ults="true "/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Anything missing?
This is the WEb.config for my webapplication....
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true " logMessagesAtTransportLeve l="true" />
</diagnostics>
<bindings>
<wsHttpBinding>
<binding name="OrderService" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="St rongWildca rd"
maxBufferPoolSize="524288" maxReceivedMessageSize="65 536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="81 92" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="163 84" />
<reliableSession ordered="true" inactivityTimeout="00:10:0 0"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Wind ows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Wind ows" negotiateServiceCredential ="true"
algorithmSuite="Default" establishSecurityContext=" true" />
</security>
</binding>
<binding name="OrderService1" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="St rongWildca rd"
maxBufferPoolSize="524288" maxReceivedMessageSize="65 536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="81 92" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="163 84" />
<reliableSession ordered="true" inactivityTimeout="00:10:0 0"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Wind ows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Wind ows" negotiateServiceCredential ="true"
algorithmSuite="Default" establishSecurityContext=" true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://admin.getwithit.ca/OrderWCF/Service1.svc"
binding="wsHttpBinding" bindingConfiguration="Orde rService" contract="ServiceReference 1.IService 1"
name="OrderService">
<identity>
<servicePrincipalName value="host/cl-t025-231cn" />
</identity>
</endpoint>
<endpoint address="http://localhost:1753/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="Orde rService1" contract="LocalService.ISe rvice1"
name="OrderService1">
<identity>
<userPrincipalName value="TECHCENTER-PC\TechC enter1-un" />
</identity>
</endpoint>
</client>
</system.serviceModel>
My IService1 class looks like this:
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Runtime.Serializati on;
using System.ServiceModel;
using System.Text;
namespace OrderWCF {
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract]
public interface IService1 {
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(C ompositeTy pe composite, string key);
[OperationContract]
bool ValidateSender(string key);
// TODO: Add your service operations here
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType {
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue {
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue {
get { return stringValue; }
set { stringValue = value; }
}
}
}
Do you see anything missing?
When I try to run my code I get this:
Fault Exception:
The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetDataUsingDataContract' 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.
Let me reexplain what I'm doing.
I have a service running on our web servers in a different network. I have a wCF service on that machine. I'm trying to call that WCF service to get information from a databse that is located on the same network as our web servers. The database is not accessible from the web so I have no choice but to access it through the web sevrer. I want to have a windows service to be running here on our local network to Hit the WCF service and get the information from our database.
Am I able to connect to the WCF service from my local website running within my local version of IIS? If I type the address to the WCF service in my broswer I am able to see it. And I'm connecting to it when I add a new service reference...I Don't understand why it's giving me to much problems!
Any help would be great thanks.
Ghost
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="Ord
<clear />
<endpoint address="" binding="wsHttpBinding" name="OrderService"
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="OrderWCF.IServic
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchang
listenUriMode="Explicit">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="OrderWCF.Service1Beh
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFa
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Anything missing?
This is the WEb.config for my webapplication....
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true
</diagnostics>
<bindings>
<wsHttpBinding>
<binding name="OrderService" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="St
maxBufferPoolSize="524288"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="81
maxBytesPerRead="4096" maxNameTableCharCount="163
<reliableSession ordered="true" inactivityTimeout="00:10:0
enabled="false" />
<security mode="None">
<transport clientCredentialType="Wind
realm="" />
<message clientCredentialType="Wind
algorithmSuite="Default" establishSecurityContext="
</security>
</binding>
<binding name="OrderService1" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="St
maxBufferPoolSize="524288"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="81
maxBytesPerRead="4096" maxNameTableCharCount="163
<reliableSession ordered="true" inactivityTimeout="00:10:0
enabled="false" />
<security mode="None">
<transport clientCredentialType="Wind
realm="" />
<message clientCredentialType="Wind
algorithmSuite="Default" establishSecurityContext="
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://admin.getwithit.ca/OrderWCF/Service1.svc"
binding="wsHttpBinding" bindingConfiguration="Orde
name="OrderService">
<identity>
<servicePrincipalName value="host/cl-t025-231cn"
</identity>
</endpoint>
<endpoint address="http://localhost:1753/Service1.svc" binding="wsHttpBinding"
bindingConfiguration="Orde
name="OrderService1">
<identity>
<userPrincipalName value="TECHCENTER-PC\TechC
</identity>
</endpoint>
</client>
</system.serviceModel>
My IService1 class looks like this:
using System;
using System.Collections.Generic
using System.Linq;
using System.Runtime.Serializati
using System.ServiceModel;
using System.Text;
namespace OrderWCF {
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract]
public interface IService1 {
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(C
[OperationContract]
bool ValidateSender(string key);
// TODO: Add your service operations here
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType {
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue {
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue {
get { return stringValue; }
set { stringValue = value; }
}
}
}
Do you see anything missing?
When I try to run my code I get this:
Fault Exception:
The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetDataUsingDataContract' 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.
Let me reexplain what I'm doing.
I have a service running on our web servers in a different network. I have a wCF service on that machine. I'm trying to call that WCF service to get information from a databse that is located on the same network as our web servers. The database is not accessible from the web so I have no choice but to access it through the web sevrer. I want to have a windows service to be running here on our local network to Hit the WCF service and get the information from our database.
Am I able to connect to the WCF service from my local website running within my local version of IIS? If I type the address to the WCF service in my broswer I am able to see it. And I'm connecting to it when I add a new service reference...I Don't understand why it's giving me to much problems!
Any help would be great thanks.
Ghost
As I mentioned earlier, 'http://tempuri.org/IService1/GetDataUsingDataContract' error comes due to not having a namespace defined in the servicecontract.
So, your class definition should be like,
[ServiceContract(Namespace = "http://ExpertsExchange.Answers.ServiceContracts/2009/02", Name = "OrderService", SessionMode = SessionMode.Allowed)]
public interface IService1 {
Got it?
So, your class definition should be like,
[ServiceContract(Namespace
public interface IService1 {
Got it?
ASKER
ok I have made the changes...
Note code below.
I'm still getting the same error...
Ideas?
System.ServiceModel.FaultE xception was unhandled by user code
Message="The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetDataUsingDataContract' 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."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe ls.Service Channel.Ha ndleReply( ProxyOpera tionRuntim e operation, ProxyRpc& rpc)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channe ls.Service ChannelPro xy.InvokeS ervice(IMe thodCallMe ssage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channe ls.Service ChannelPro xy.Invoke( IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr oxies.Real Proxy.Hand leReturnMe ssage(IMes sage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Pr oxies.Real Proxy.Priv ateInvoke( MessageDat a& msgData, Int32 type)
at ServiceReference1.IService 1.GetDataU singDataCo ntract(Com positeType composite, String key)
at ServiceReference1.Service1 Client.Get DataUsingD ataContrac t(Composit eType composite, String key) in d:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\orderwcftest\f384daf 1\a4aca58d \App_WebRe ferences.b ueqgual.1. cs:line 122
at _Default.btnHitService_Cli ck(Object sender, EventArgs e) in d:\Inetpub\wwwroot\OrderWC FTest\Defa ult.aspx.c s:line 17
at System.Web.UI.WebControls. Button.OnC lick(Event Args e)
at System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument)
at System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData)
at System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt)
InnerException:
Note code below.
I'm still getting the same error...
Ideas?
System.ServiceModel.FaultE
Message="The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetDataUsingDataContract' 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."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at ServiceReference1.IService
at ServiceReference1.Service1
at _Default.btnHitService_Cli
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException:
IService1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace OrderWCF {
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract(Namespace = "http://ExpertsExchange.Answers.ServiceContracts/2009/02", Name = "OrderService", SessionMode = SessionMode.Allowed)]
public interface IService1 {
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite, string key);
[OperationContract]
bool ValidateSender(string key);
// TODO: Add your service operations here
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class CompositeType {
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue {
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue {
get { return stringValue; }
set { stringValue = value; }
}
}
}
Service1.svc.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace OrderWCF {
public class Service1 : IService1 {
public string GetData(int value) {
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite, string key) {
if (ValidateSender(key)) {
if (composite.BoolValue) {
composite.StringValue += " Suffix On the web...";
}
}
else {
composite.StringValue = "You are not validated!";
}
return composite;
}
}
}
Service web.config
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="OrderWCF.Service1Behavior" name="OrderWCF.Service1">
<clear />
<endpoint address="" binding="wsHttpBinding" name="OrderService"
bindingNamespace="http://ExpertsExchange.Answers.ServiceContracts/2009/02"
contract="OrderWCF.IService1" listenUriMode="Explicit">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
listenUriMode="Explicit">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="OrderWCF.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
THIS IS THE CODE FOR MY LOCAL WEB APPLICATION!!!
protected void btnHitService_Click(object sender, EventArgs e) {
ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
client.Open();
ServiceReference1.CompositeType comType = client.GetDataUsingDataContract(
new ServiceReference1.CompositeType {
BoolValue = true,
StringValue = "WEB1 Service"
}, "SampleKey");
lblAnswer.Text = comType.StringValue;
client.Close();
}
Web.config for the local WEB APPLICATION
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<wsHttpBinding>
<binding name="OrderService" 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="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://getwithit.ca/OrderWCF/Service1.svc"
binding="wsHttpBinding" bindingConfiguration="OrderService" contract="ServiceReference1.IService1"
name="OrderService">
<identity>
<servicePrincipalName value="host/cl-t025-231cn" />
</identity>
</endpoint>
</client>
</system.serviceModel>
ASKER
new info..
I ran it again and now I'm getting this error message..
The message could not be processed. This is most likely because the action 'http://ExpertsExchange.Answers.ServiceContracts/2009/02/OrderService/GetDataUsingDataContract' 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.
I ran it again and now I'm getting this error message..
The message could not be processed. This is most likely because the action 'http://ExpertsExchange.Answers.ServiceContracts/2009/02/OrderService/GetDataUsingDataContract' 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.
Try to increase timeout (receiveTimeout and other timeout as well)...
<binding name="OrderService" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
Does your takes sometime to respond? any data oriented operations happening?
<binding name="OrderService" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
Does your takes sometime to respond? any data oriented operations happening?
ASKER
Timeouts changed:
<binding name="OrderService" closeTimeout="01:01:00" openTimeout="01:01:00"
receiveTimeout="01:10:00" sendTimeout="01:01:00" bypassProxyOnLocal="false"
The service does nothing. We send a string, the service concatenates another string to it and sends it back.
Getting error:
System.ServiceModel.FaultE xception was unhandled by user code
Message="The message could not be processed. This is most likely because the action 'http://ExpertsExchange.Answers.ServiceContracts/2009/02/OrderService/GetDataUsingDataContract' 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."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe ls.Service Channel.Ha ndleReply( ProxyOpera tionRuntim e operation, ProxyRpc& rpc)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channe ls.Service ChannelPro xy.InvokeS ervice(IMe thodCallMe ssage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channe ls.Service ChannelPro xy.Invoke( IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr oxies.Real Proxy.Hand leReturnMe ssage(IMes sage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Pr oxies.Real Proxy.Priv ateInvoke( MessageDat a& msgData, Int32 type)
at ServiceReference1.OrderSer vice.GetDa taUsingDat aContract( CompositeT ype composite, String key)
at ServiceReference1.OrderSer viceClient .GetDataUs ingDataCon tract(Comp ositeType composite, String key) in d:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\orderwcftest\f384daf 1\a4aca58d \App_WebRe ferences.3 xxxnlnf.1. cs:line 127
at _Default.btnHitService_Cli ck(Object sender, EventArgs e) in d:\Inetpub\wwwroot\OrderWC FTest\Defa ult.aspx.c s:line 17
at System.Web.UI.WebControls. Button.OnC lick(Event Args e)
at System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument)
at System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData)
at System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt)
InnerException:
<binding name="OrderService" closeTimeout="01:01:00" openTimeout="01:01:00"
receiveTimeout="01:10:00" sendTimeout="01:01:00" bypassProxyOnLocal="false"
The service does nothing. We send a string, the service concatenates another string to it and sends it back.
Getting error:
System.ServiceModel.FaultE
Message="The message could not be processed. This is most likely because the action 'http://ExpertsExchange.Answers.ServiceContracts/2009/02/OrderService/GetDataUsingDataContract' 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."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at ServiceReference1.OrderSer
at ServiceReference1.OrderSer
at _Default.btnHitService_Cli
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException:
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok So I matched all the binding names and I configured a new basic endpoint and now it works.
I want to try to configure the wsHttpBinding. when I run it I get this error.
System.ServiceModel.Securi ty.Securit yNegotiati onExceptio n was unhandled by user code
Message="The caller was not authenticated by the service."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Securi ty.Issuanc eTokenProv iderBase`1 .DoNegotia tion(TimeS pan timeout)
at System.ServiceModel.Securi ty.SspiNeg otiationTo kenProvide r.OnOpen(T imeSpan timeout)
at System.ServiceModel.Securi ty.Wrapper SecurityCo mmunicatio nObject.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Securi ty.Communi cationObje ctSecurity TokenProvi der.Open(T imeSpan timeout)
at System.ServiceModel.Securi ty.Securit yUtils.Ope nTokenProv iderIfRequ ired(Secur ityTokenPr ovider tokenProvider, TimeSpan timeout)
at System.ServiceModel.Securi ty.Symmetr icSecurity Protocol.O nOpen(Time Span timeout)
at System.ServiceModel.Securi ty.Wrapper SecurityCo mmunicatio nObject.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Securit yChannelFa ctory`1.Cl ientSecuri tyChannel` 1.OnOpen(T imeSpan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Securi ty.Securit ySessionSe curityToke nProvider. DoOperatio n(Security SessionOpe ration operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
at System.ServiceModel.Securi ty.Securit ySessionSe curityToke nProvider. GetTokenCo re(TimeSpa n timeout)
at System.IdentityModel.Selec tors.Secur ityTokenPr ovider.Get Token(Time Span timeout)
at System.ServiceModel.Securi ty.Securit ySessionCl ientSettin gs`1.Clien tSecurityS essionChan nel.OnOpen (TimeSpan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.On Open(TimeS pan timeout)
at System.ServiceModel.Channe ls.Communi cationObje ct.Open(Ti meSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca llOpenOnce .System.Se rviceModel .Channels. ServiceCha nnel.ICall Once.Call( ServiceCha nnel channel, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca llOnceMana ger.CallOn ce(TimeSpa n timeout, CallOnceManager cascade)
at System.ServiceModel.Channe ls.Service Channel.En sureOpened (TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channe ls.Service Channel.Ca ll(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channe ls.Service ChannelPro xy.InvokeS ervice(IMe thodCallMe ssage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channe ls.Service ChannelPro xy.Invoke( IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr oxies.Real Proxy.Hand leReturnMe ssage(IMes sage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Pr oxies.Real Proxy.Priv ateInvoke( MessageDat a& msgData, Int32 type)
at OrderWCF.OrderService.GetD ataUsingDa taContract (Composite Type composite, String key)
at OrderWCF.OrderServiceClien t.GetDataU singDataCo ntract(Com positeType composite, String key) in d:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\orderwcftest\f384daf 1\a4aca58d \App_WebRe ferences.m jt8jjmb.1. cs:line 127
at _Default.btnHitService_Cli ck(Object sender, EventArgs e) in d:\Inetpub\wwwroot\OrderWC FTest\Defa ult.aspx.c s:line 17
at System.Web.UI.WebControls. Button.OnC lick(Event Args e)
at System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument)
at System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData)
at System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt)
InnerException: System.ServiceModel.FaultE xception
Message="The request for security token could not be satisfied because authentication failed."
Source="System.ServiceMode l"
Action="http://www.w3.org/2005/08/addressing/soap/fault"
StackTrace:
at System.ServiceModel.Securi ty.Securit yUtils.Thr owIfNegoti ationFault (Message message, EndpointAddress target)
at System.ServiceModel.Securi ty.SspiNeg otiationTo kenProvide r.GetNextO utgoingMes sageBody(M essage incomingMessage, SspiNegotiationTokenProvid erState sspiState)
InnerException:
How can I authenticate to the service? Almost there..... :)
I want to try to configure the wsHttpBinding. when I run it I get this error.
System.ServiceModel.Securi
Message="The caller was not authenticated by the service."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Channe
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Securi
at System.ServiceModel.Securi
at System.IdentityModel.Selec
at System.ServiceModel.Securi
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at OrderWCF.OrderService.GetD
at OrderWCF.OrderServiceClien
at _Default.btnHitService_Cli
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException: System.ServiceModel.FaultE
Message="The request for security token could not be satisfied because authentication failed."
Source="System.ServiceMode
Action="http://www.w3.org/2005/08/addressing/soap/fault"
StackTrace:
at System.ServiceModel.Securi
at System.ServiceModel.Securi
InnerException:
How can I authenticate to the service? Almost there..... :)
ASKER
I got it.
Thanks so much for your help!
Proxy.ClientCredentials.Wi ndows.Clie ntCredenti al.UserNam e = "uname";
Proxy.ClientCredentials.Wi ndows.Clie ntCredenti al.Passwor d = "pword";
Ghost
Thanks so much for your help!
Proxy.ClientCredentials.Wi
Proxy.ClientCredentials.Wi
Ghost
ASKER
Now I'm getting this:
System.ServiceModel.FaultE
Message="The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetDataUsingDataContract' 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."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
at System.ServiceModel.Channe
Exception rethrown at [0]:
at System.Runtime.Remoting.Pr
at System.Runtime.Remoting.Pr
at ServiceReference1.IService
at ServiceReference1.Service1
at _Default.btnHitService_Cli
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.WebControls.
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.RaisePo
at System.Web.UI.Page.Process
InnerException:
This looks alot like my previous error...This might provide more clues...