Couldn't create WebService

Couldn't create WebService

Old forum URL: forums.lhotka.net/forums/t/4473.aspx


Kiri posted on Friday, March 07, 2008

I read the book and follow the sample application from CSLA.NET 2.0.

I have a problem to create WebService project and add Web Reference from the Csla class.

In the PTWebService project contains PTService.asmx and PTService.cs that has all Methods.

In the WebServicesHost project contains only WebServicePortal.asmx that has a code like this:

      <%@ WebService Language="C#" Class="Csla.Server.Hosts.WebServicePortal" %>

When I add Web Reference and browse, It cannot refer to the WebServicesProxy class.  It's look like this:

    
Line 1:  <%@ WebService Language="C#" Class="Csla.Server.Hosts.WebServicePortal" %>

In the IIS, I create 2 virtual web.  One for the PTService.asmx and another for WebServicePortal.asmx.

The book said, ensure Csla.dll is in the Bin directory.  My question is which Bin directory?  The PTService.asmx bin or the WebServicePortal.asmx bin directory?

RockfordLhotka replied on Monday, March 10, 2008

You are trying to recreate CSLA yourself?

If you are just trying to use the data portal you don't need to add a web reference. The only time you need to add that web reference for the data portal is if you are recreating CSLA.

If that is what you are trying to do, that's fine - but this was a tricky thing to accomplish, because Csla.dll is both the source and consumer of the web service for the data portal.

  1. You need to create the Csla project server components and build the project.
  2. Then you need to create a temporary web service that hosts that Csla.dll (the DLL, not the project!!!) and exposes the web service.
  3. Then you need to open the Csla project and add a web reference to that temporary service hosting Csla.dll.

Once this is done you can discard that temporary web service and the Csla.dll file created in step 1 (because it wasn't complete anyway).

Like I said, kind of tricky, but since you only need to do this once ever it isn't a big deal.

Again, none of this is necessary to use the data portal through web services. To do that, just read Chapter 12 and follow those (simpler) directions.

Copyright (c) Marimer LLC