Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2007

Tip: Looking for answers? Try searching our database.

VS2005 Add Service Reference not generating security proxy informa

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed Shnekendorf - 12 Nov 2007 23:01 GMT
I am trying to create a WCF host/client combination using mixed security with
UserName authentication.

Everything looks good on the host side, but when I go to generate the client
proxy using the VS 2005 "Add Service Reference" wizard it generates a proxy
class that, while correct in all respects for my service, doesn't seem to
have any knowledge of security credentials.  

I'm looking to be able to do something like:

proxy.ClientCredentials.UserName.UserName = "name";

but neither the proxy generate nor the additions to my app.config seem to
recognize the security choices I've made in the web.config of my host.

The servicemodel portion of my web.config is below.  Any ideas?

<system.serviceModel>
   <behaviors>
       <serviceBehaviors>
           <behavior name="MyBehavior">
               <serviceDebug includeExceptionDetailInFaults="false"/>
               <serviceCredentials>                    <userNameAuthentication
userNamePasswordValidationMode="Custom"    customUserNamePasswordValidatorType="MyValidator, App_code"/>
               </serviceCredentials>
               <serviceMetadata httpGetEnabled="true"/>
           </behavior>
      </serviceBehaviors>
  </behaviors>
       
  <services>
      <service behaviorConfiguration="MyBehavior"  name="MyInterface">
      <endpoint binding="wsHttpBinding"  name="wsHttpWithUsername"
        contract="IMyInterface"/>
      <endpoint address="mex"   binding="mexHttpBinding"
       name="mexHttpBinding" contract="IMetadataExchange" />
      </service>
   </services>

<bindings>
   <wsHttpBinding>
       <binding name="wsHttpWithUsername">
           <security mode="TransportWithMessageCredential" >
               <message clientCredentialType="UserName" />
          </security>
       </binding>
  </wsHttpBinding>
</bindings>

</system.serviceModel>

Thanks in advance!
Ed
Spam Catcher - 13 Nov 2007 06:02 GMT
=?Utf-8?B?RWQgU2huZWtlbmRvcmY=?=
<EdShnekendorf@discussions.microsoft.com> wrote in
news:4A2175A3-E498-47A8-8138-ACC56A2CFB45@microsoft.com:

> <userNameAuthentication
> userNamePasswordValidationMode="Custom"    
> customUserNamePasswordValidatorType="MyValidator, App_code"/>

This line looks a bit fishy... I think you didn't set your validator type
correctly.

I could be wrong ... Since I normally use  a web application project.

When you set a breakpoint in your validation code  - is it being hit?
Ed Shnekendorf - 13 Nov 2007 15:09 GMT
Hi,

The problem is that I'm not even getting this far.... I've generated the
service host and I can see the WSDL when I browse to it.  I then use the Add
Service Reference wizard in the client to generate a proxy class and the
proxy class is not generated with access to credentials.

I've seen samples where people set credentials like this:

           ChannelFactory<IMDMSInterface> factory =
               new ChannelFactory<IMDMSInterface>("MyBinding");
           factory.Credentials.UserName.UserName = "test1";
           factory.Credentials.UserName.Password = "1tset";
           IMyService service = factory.CreateChannel();

But I was thinking that I shouldn't have to do this and should be able to
access the Credentials object directly from the generated proxy class.

Any thoughts?  Thanks,
Ed

> =?Utf-8?B?RWQgU2huZWtlbmRvcmY=?=
> <EdShnekendorf@discussions.microsoft.com> wrote in
[quoted text clipped - 10 lines]
>
> When you set a breakpoint in your validation code  - is it being hit?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.