locked
How to share a vb Class for 3+ web applications? RRS feed

  • Question

  • User664551031 posted

    I have three different web applications that I made in VS08 vb.net.  Each application uses a class that i continue to update (MyClass.vb), other than using Vault to propogate changes, is it possible to create a class or dll and put it out on the webserver and have each web app call that class or dll?

    This may be common practice or easily done, but i'm still new and learning so any guidance is greatly appreciated.

    Thanks in advance!

    Thursday, December 17, 2009 10:32 AM

Answers

  • User-952121411 posted

    Yes, great question and welcome to the wonderful world of Services!

    There are so many ways to share functionality in the exact manner you mentioned, but in .NET the 1st (2) that come to mind are a WCF (Windows Communication Foundation) Service, or an .asmx Web Service.

    WCF is the recommended approach from .NET Framework 3.0+ and has a lot more functionality as far as communication protocols, architecture, and security.  However, for a beginner in my opinion a WCF service has a much greater learning curve that a traditional .asmx web service.

    Basically, you will centralize the functionality you want in either type of service and then install that service on the server.  If it is a Web Service it will be installed in IIS, and communicate via HTTP.  If it is a WCF service there are several install options (IIS, Windows Service, WAS) and communication protocols (HTTP, netTCP, etc.) that can be configured.

    Once your service is online, it is simple to consume it from your ASP.NET or any .NET application and call in a similar fashion as you would a local class.  Now being new, you are going to need to do some reading on setting up basic services to understand them.  To be honest, if you are really new to .NET I would recommend a .asmx Web Service just to get the principals down, and then in the future migrate it to a WCF service.  But if you want to be current from the get-go, you can do a WCF service.

    Here are some links to get you started:

    Web Services (How Do I in Visual Basic): (great resource with lots of good links from building your 1st service to deploying it to the server)

    http://msdn.microsoft.com/en-us/library/ms172568(VS.80).aspx

    Beginner's Guide to Windows Communication Foundation:

    http://msdn.microsoft.com/en-us/netframework/first-steps-with-wcf.aspx

    There are so many good links and other information on WCF, so once you determine what you are going to do and how, you could post a new thread with specific questions to help further.

    Hope this helps! Smile

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 17, 2009 11:13 AM
  • User274223912 posted

    Create a new project for your library.  Compile the project and then include the output DLL in the references as already mentioned in the thread.

    Alternatively, if you are managing all of the applications in the same solution, create the new project there and then include a reference to the project.  You will have to use the fully qualified name space OR include it using imports statement. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 18, 2009 7:55 PM

All replies

  • Thursday, December 17, 2009 11:08 AM
  • User-952121411 posted

    Yes, great question and welcome to the wonderful world of Services!

    There are so many ways to share functionality in the exact manner you mentioned, but in .NET the 1st (2) that come to mind are a WCF (Windows Communication Foundation) Service, or an .asmx Web Service.

    WCF is the recommended approach from .NET Framework 3.0+ and has a lot more functionality as far as communication protocols, architecture, and security.  However, for a beginner in my opinion a WCF service has a much greater learning curve that a traditional .asmx web service.

    Basically, you will centralize the functionality you want in either type of service and then install that service on the server.  If it is a Web Service it will be installed in IIS, and communicate via HTTP.  If it is a WCF service there are several install options (IIS, Windows Service, WAS) and communication protocols (HTTP, netTCP, etc.) that can be configured.

    Once your service is online, it is simple to consume it from your ASP.NET or any .NET application and call in a similar fashion as you would a local class.  Now being new, you are going to need to do some reading on setting up basic services to understand them.  To be honest, if you are really new to .NET I would recommend a .asmx Web Service just to get the principals down, and then in the future migrate it to a WCF service.  But if you want to be current from the get-go, you can do a WCF service.

    Here are some links to get you started:

    Web Services (How Do I in Visual Basic): (great resource with lots of good links from building your 1st service to deploying it to the server)

    http://msdn.microsoft.com/en-us/library/ms172568(VS.80).aspx

    Beginner's Guide to Windows Communication Foundation:

    http://msdn.microsoft.com/en-us/netframework/first-steps-with-wcf.aspx

    There are so many good links and other information on WCF, so once you determine what you are going to do and how, you could post a new thread with specific questions to help further.

    Hope this helps! Smile

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 17, 2009 11:13 AM
  • User274223912 posted

    Create a new project for your library.  Compile the project and then include the output DLL in the references as already mentioned in the thread.

    Alternatively, if you are managing all of the applications in the same solution, create the new project there and then include a reference to the project.  You will have to use the fully qualified name space OR include it using imports statement. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 18, 2009 7:55 PM