.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Factory class for proxies

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :WCF
 

 

My project consumes 2 different services and I have a helper class as follows

public ServiceHelper{

public const WebService1.ServiceClient  Service1Client = new WebService1.ServiceClient();

public const WebService2.ServiceClient  Service2Client = new WebService2.ServiceClient();

 

public object GetServiceClient(int id)

{

     switch(id)

{

case 1:

return Service1Client;

case 2:

return Service2Client;

}

}

}

 

Now I have a function MethodA(int id)

{

var client = ServiceHelper.GetServiceClient(id);

}

How do I typecast this var to the correct Proxy? or how can I return ServiceClient from GetServiceClient??




View Complete Post


More Related Resource Links

OWC11.Spreadsheet.11 - Retrieving the COM class factory for component with CLSID {} failed due to th

  
We have a web application (C#) which uses OWC11.Spreadsheet.11 to create excel files. This application works fine on XP 32bit, Windows 2003 server 32 bit versions. Recently we moved our application to a Windows 2008 web server 64bit machine. Now when we run the appication and call the functionality generate the Excel files which uses OWC11.Spreadsheet.11 it throws the following error.Retrieving the COM class factory for component with CLSID {0002E559-0000-0000-C000-000000000046} failed due to the following error: 80040154.In the code we use this library as follows using Microsoft.Office.Interop.Owc11; SpreadsheetClass xlsheet = new SpreadsheetClass();We have registered the Microsoft.Office.Interop.Owc11.dll in the global assembly cash as we have done in 2003 server.  We also tried running owc11.exe to insall all office 2003 web components.Can anyone help us to sort this issue.Thanks in advance.Sam

SQLTask fails :: f"Retrieving the COM class factory for component with CLSID {19E353EF-DAF4-45D8-9A0

  
OS :: Windows 2008 R2 x64 SQL :: 2008 R2 Enterprise x64 The package and task worked fine untill I migrated to a different server, now the SQL Task fails with the following error msg, see below. The package was developed on the same OS & version of SQL.   SSIS package "Package.dtsx" starting. Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "" failed with the following error: "Retrieving the COM class factory for component with CLSID {19E353EF-DAF4-45D8-9A04-FB7F7798DCA7} failed due to the following error: 800700c1.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Task failed: Execute SQL Task SSIS package "Package.dtsx" finished: Success.  

Retrieving the COM class factory for component with CLSID {6568E194-96D8-4035-9087-99E4F75E9ABC} fai

  
We are accessing Adobe Photoshop through ASP.NET application and using following two DLLs: [1] Interop.Photoshop.dll [2] Interop.PhotoshopTypeLibrary.dll If we execute the web application within MS Visual Studio (IDE), its working fine and no such error. If we deploy the application in IIS then start producing following error: ------------------------- [UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {6568E194-96D8-4035-9087-99E4F75E9ABC} failed due to the following error: 80070005.]    _Default.Button1_Click(Object sender, EventArgs e) +45    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 ------------------------- Using regedit we have looked for {6568E194-96D8-4035-9087-99E4F75E9ABC} and found several entries. We have assigned full privileges to ASP.NET, IUS

Error:Retrieving the COM class factory for component with CLSID {} failed due to the following error

  
Hi,
  I am trying to take screenshots of any open Internet Explorer. I have writen the code and it works fine when I run the site in debug mode.
  Once the site is published I get the following error:

Retrieving the COM class factory for component with CLSID {9BA05972-F6A8-11CF-A442-00A0C90A8F39} failed due to the following error: 8007000e.

This error is shown for the following line:
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();

I have given permission to various files for aspnet user.

I have looked up most of the forum but to no avail.

Any help would be greatly appreciated.

Thanks,


Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046}

  

Hello,

I have developed an .net application in VS 2008 (.NET FRAME WORK 3.5) with MS-SQL Server 2005 as database.

Application works absoultely fine in my local machine but when i installed it in the server it shows me the following error message.

I have done lots of googling and cant solve the problem.

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005.

Source Error:

Line 286:        'Dim isVisible As Object
Line 287:        'Dim missing As Object
Line 288:        Dim oWordApp As New Word.ApplicationClass()
Line 289:        'Dim oWordDoc As Word.Document
Line 290:

Thanks

Nick

<

Retrieving the COM class factory for component with CLSID {5D34E962-9F95-4D92-917F-F9B1A4F2BC6E} fai

  

Hello,

  I am writing a simple web service that instantiates a very simple COM object and then makes a call to the object...  All parts are very simple so that i can atleast see that it works. My web service consists of one Web method... See below...

 ... TEMPCONVERTLibClass instance;

instance = new TEMPCONVERTLibClass();

...

[WebMethod(Description="Sample function to access tempconvert object",

TransactionOption=System.EnterpriseServices.TransactionOption.RequiresNew)]

public double CelsToFahren(double val) { double far = 0.0;

Retrieving the COM class factory for component with CLSID {0D43FE01-F093-11CF-8940-00A0C9054228} err

  

Retrieving the COM class factory for component with CLSID {0D43FE01-F093-11CF-8940-00A0C9054228} error 8002801d

 

here is the link to an image

 

http://gyazo.com/37173e56426da8e8d13904b3a03c58e0.png


Outlook Error - Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-0

  

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.

This is the error i get when executes my application through iis.

I am trying to attach a file to microsoft outlook.

Please any body help me to figure this out.

I have been looking abt this error since last week. Please help me...

 

Thanx in advance.


SharePoint 2007 Search error Retrieving the COM class factory for component with CLSID {5AD0CC67-477

  

Hi All,

SharePoint search started failing all of a sudden, so I did some reading and performed "Reset all crawled content". Now the crawl is running fine, however, when search is performed on the site, following exception is thrown:

System.Runtime.InteropServices.COMException (0x800703FA): Retrieving the COM class factory for component with CLSID {5AD0CC67-4776-4D91-B9A8-0078B0BAF32D} failed due to the following error: 800703fa. at Microsoft.Office.Server.Search.Query.QueryInfo.InitializeCanaryChecker() at Microsoft.Office.Server.Search.Query.QueryInfo.GenerateDigest(Page CurrentPage) at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.ClickLogPostdata() at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnPreRender(EventArgs e)

I came across only one post when I searched for this particular problem and I don't believe we have the same case here. [http://social.technet.microsoft.com/Forums/en-GB/sharepointadmin/thread/84861057-d862-464d-b5fc-888db5bd6805]

Any help would be great.


Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} fai

  

Hi all,

I am not able to access MS Word COM object when the sharepoint server is logged off.

i am getting the following error:

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.

Any help would be greatly appreciated.

Thanks,


Abstract Factory Design in C# , Vb.NET

  
Provide an interface for creating families of related or dependent objects without specifying their concrete classes

Class Diagrams

  
Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

Creating a Simple Class in C#

  
The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Static Class for Beginners

  
In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

Factory Pattern in asp.net

  
The job of the Factory design pattern is to create concrete sub classes. You can see the Factory design pattern used throughout the .NET Framework.

The essence of the Factory Pattern is to "Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses." Factory methods encapsulate the creation of objects. This can be useful if the creation process is very complex, for example if it depends on settings in configuration files or on user input.

The Factory Design Pattern

  
Software architects generally think in terms of high-level abstractions rather than low-level programming details. Representing a system in terms of high-level abstractions promotes understanding of the system and reduces its perceived complexity. One such set of abstractions is software design patterns. They have been successfully applied in the past to simplify and solve recurring problems in software design.

Abstract Factory Design Pattern (Sample in C# and VB .NET)

  
An abstract factory provides an interface for creating families of related objects without specifying their concrete classes. Sometimes one wants to construct an instance of one of a suite of classes, deciding between the classes at the time of instantiation. In order to avoid duplicating the decision making everywhere an instance is created, we need a mechanism for creating instances of related classes without necessarily knowing which will be instantiated.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend