Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
After hosting my application on server I am getting below error can some body will advice me what changes I need to make so that service will work fine?

System.InvalidOperationException: The contract operation 'OperationName' requires Windows identity for automatic impersonation. A Windows identity that represents the caller is not provided by binding ('WebHttpBinding','http://tempuri.org/') for contract ('Contract Name','http://tempuri.org/'.

Thanks in advance
Posted
Comments
JoCodes 5-Feb-14 1:21am    
Can you post the Code block which is throwing the error as well as the Binding Configurations used?
suhel_khan 5-Feb-14 1:27am    
hi jocodes,

When accessing the service through URL there only i am getting this error, whereas in localhost it was working fine so cant tell you at which code part is throwing error.
JoCodes 5-Feb-14 1:42am    
Are you decorating the method with operationalbehaviour attribute t
suhel_khan 5-Feb-14 1:52am    
Yes I am doing that
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
JoCodes 5-Feb-14 1:58am    
Can you check the link posted as a solution. It may help you.authentication scheme was the change it was done to it

Just added this line in my service.cs.

previously added all the changes in web.config is backed out.
C#
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]


and its working fine.

Thanks everyone.. specially CodeProject...
 
Share this answer
 
v2
Refer below link , a similar issue which has been solved.

http://stackoverflow.com/questions/6530477/impersonation-in-self-hosted-wcf[^]
 
Share this answer
 
Comments
suhel_khan 5-Feb-14 2:41am    
Hey still getting the same error :(
suhel_khan 5-Feb-14 4:42am    
Thanks a lot JoCodes...:)
JoCodes 5-Feb-14 5:32am    
Welcome :) .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900