code_junkie

Why doesn't my ChannelFactory see my endpoint configuration?

Nov 13th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. public AdminClient()
  2. {
  3. ChannelFactory<IProductAdmin> factory = new ChannelFactory<IProductAdmin>();
  4. productAdminChannel = factory.CreateChannel();
  5. }
  6.  
  7. <system.serviceModel>
  8. <client>
  9. <endpoint address="net.tcp://localhost:8002/ProductBrowser"
  10. binding="netTcpBinding"
  11. contract="Contracts.IProductAdmin" />
  12. </client>
  13. </system.serviceModel>
  14.  
  15. public AdminClient()
  16. {
  17. var fac = new ChannelFactory<IProductAdmin>("admin");
  18. productAdminChannel = fac.CreateChannel();
  19. }
  20.  
  21. <system.serviceModel>
  22. <client>
  23. <endpoint name="admin"
  24. address="net.tcp://localhost:8002/ProductBrowser"
  25. binding="netTcpBinding"
  26. contract="Contracts.IProductAdmin" />
  27. </client>
  28. </system.serviceModel>
  29.  
  30. public AdminClient()
  31. {
  32. ChannelFactory<IProductAdmin> factory
  33. = new ChannelFactory<IProductAdmin>("*");
  34.  
  35. productAdminChannel = factory.CreateChannel();
  36. }
  37.  
  38. using System;
  39. using System.ServiceModel;
  40.  
  41. namespace CoDeMagazine.ServiceArticle
  42. {
  43. public class ProductClient
  44. : ClientBase<IProductBrowser>,
  45. IProductBrowser
  46. {
  47.  
  48. #region IProductBrowser Members
  49.  
  50. public ProductData GetProduct(
  51. Guid productID)
  52. {
  53. return Channel.GetProduct(productID);
  54. }
  55.  
  56. public ProductData[] GetAllProducts()
  57. {
  58. return Channel.GetAllProducts();
  59. }
  60.  
  61. public ProductData[] FindProducts(
  62. string productNameWildcard)
  63. {
  64. return Channel.FindProducts(
  65. productNameWildcard);
  66. }
  67.  
  68. #endregion
  69. }
  70.  
  71. }
  72.  
  73. public AdminClient()
  74. {
  75. ChannelFactory<IProductAdmin> factory =
  76. new ChannelFactory<IProductAdmin>(string.Empty);
  77. productAdminChannel = factory.CreateChannel();
  78. }
Add Comment
Please, Sign In to add comment