Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > WCF service, legacy client using Basic authentication?

Reply
Thread Tools

WCF service, legacy client using Basic authentication?

 
 
Jeff Stephens
Guest
Posts: n/a
 
      06-02-2009
I am trying to develop a WCF service hosted in IIS that will be called by a
Windows Mobile client. Because the client is using the Compact Framework, it
appears I won't be able to use either WCF or WSE in the client. The web
service will require authentication. I am therefore trying to use Basic
Authentication over HTTPS.

I have a simple WCF service, and a WCF client that works great. But for the
life of me, I can't get a simple web service client that works. I am using
VS 2008, the client project is targeted for .NET 2.0, and added a standard
web reference. I am supplying credentials to the proxy as follows:

proxy.Credentials = new System.Net.NetworkCredential(@"MyUserName",
"MyPassword", "MyDomain");

The config file for my service is as follows:

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicAuthenticationConfiguration">
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="CalculatorService.Service"
behaviorConfiguration="CalculatorServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://MyServer/CalculatorService/Service.svc" />
</baseAddresses>
</host>
<endpoint
name="BasicAuthenticationEndpoint"
address=""
binding="basicHttpBinding"
bindingConfiguration="BasicAuthenticationConfigura tion"
contract="CalculatorService.ICalculator" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

The response I get is:

System.Net.WebException: The request failed with HTTP status 401:
Unauthorized.

Oddly enough, if I omit the Domain parameter from the NetworkCredential
constructor, and instead use "MyDomain\MyUserName" in the UserName parameter,
I get a "401: Access Denied." response instead of "Unauthorized".

I'm sure that the credentials I'm using are valid (and indeed the same
credentials work just fine in the WCF client). It seems to make no
difference whether I use basicHttpBinding or wsHttpBinding.

What am I doing wrong? Any suggestions, thoughts, speculation or advice
would be very welcome at this point!
 
Reply With Quote
 
 
 
 
Jeff Stephens
Guest
Posts: n/a
 
      06-02-2009
Of course, as soon as I post this, I get it working. The solutions was to
disable "Integrated Windows authentication" in IIS. Why that would do the
trick, when I'm passing a Windows domain login, I don't understand. But at
least the client works now.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WCF client passing 2 client authentication tokens? Markus Leder ASP .Net Web Services 1 04-14-2010 10:36 AM
Difference between Ajax Enabled WCF service and regular WCF? Cindy Lee ASP .Net 1 03-19-2010 05:59 PM
AJAX enabled WCF Service Vs Standard WCF Service Simon ASP .Net 0 10-13-2009 09:13 AM
Change ASMX WS to WCF for exiting client Saar Carmi ASP .Net 1 10-06-2007 01:12 PM
asp.net wcf client nyhetsgrupper@gmail.com ASP .Net 0 03-18-2007 06:56 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57