locked
ObjectDataSource control and WCF Service with Multiple Endpoints RRS feed

  • Question

  • User-651425173 posted

    I am using an ObjectDataSource to connect to a WCF service I am using. I have been doing this for a while but we had to introduce a new endpoint today and now I need to be able to setup the object data source to go to the right endpoint.When I go through the wizard to configure the ObjectDataSource it shows two instances fo my service (obviously the two endpoints) but it wont differentiate them and it does not in the code. How can I set this up in the ObjectDataSource?

    Tuesday, December 1, 2009 5:12 PM

All replies

  • User1677448765 posted

    what u re telling is not the case. suppose u re using  WSHttp binding in both endpoint but the contract and address is different cant be same. 

    Tuesday, December 1, 2009 6:46 PM
  • User-651425173 posted

    This is not the issue...I have manual source code calls to the services and they work fine with the both end points defined. The issue is simply...how do you define an endpoint in an ObjectDataSource? Before I had the different endpoints, I used to define the Type parameter as "MyServices.MyService" (name changed to protect the innocent Wink). This worked fine because I had one endpoint...now I have two.

    In code I would define it like this MyServiceClient services = new MyServiceClient("SecureEndpoint"); as an example...how do you do this with the ObjectDataSource? 

    Tuesday, December 1, 2009 7:06 PM
  • User1677448765 posted

    when u ve multiple endpoints configured then u should provide configuration name while generating proxy. 

    Tuesday, December 1, 2009 8:59 PM
  • User-651425173 posted

    I did do that...this has nothing to do with the proxy! This has to do with how you configure an object data source to work with multiple endpoint configured services.  

    Tuesday, December 1, 2009 11:12 PM
  • User2059290968 posted
            protected void Page_Load(object sender, EventArgs e)
            {
                objectDataSourceProducts.ObjectCreating += new ObjectDataSourceObjectEventHandler(objectDataSourceProducts_ObjectCreating);
            }
    
            void objectDataSourceProducts_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
            {
                e.ObjectInstance = new ProductService.ProductClient("NetNamedPipeBinding");
            }
    

    Sunday, April 7, 2013 6:00 PM