locked
Getting Started sample not getting service.exe RRS feed

  • Question

  • Hi,

    Well, I have been trying to get this first sample "Getting Started" going for a very very long time, and so far, I've been pulling my hair out just trying to figure out what is going on.

    My question is, when i compile the "Getting Started sample" which is from WIndows SDK, it compiles fine, and I find client.exe but I can not find service.exe anywhere. Neither under Getting Started/service/bin folder which produces service.dll file and service.pdb nor under wwwroot/servicemodelsamples/bin directory.

    I got the console based sample going but I really want this IIS based samples to work as well.

    Any help would be greatly appreciated.

    Thanks.

    Wednesday, June 21, 2006 1:19 AM

Answers

All replies

  • To Create a Self-Hosted Service with WCF (non-IIS), you need create a new Project for Host and Publish it then.

    To host a WCF Service, you can create a Windows Service, or a Console Application or a Windows Application. Then add a reference to System.ServiceModel Assembly and host it using the ServiceHost Class. You can use a code as the following:

    using System.ServiceModel;

    ....
    Uri[] baseAddress = new Uri[]{new Uri("http://localhost:4040/Implementation")};
    ServiceHost host = new ServiceHost(typeof(ServiceImplementation),
    baseAddress);
    // You can use also other uri schemes to create the service

    // Then Open the host with:
    host.Open();

    I Hopes that it help you.

    In the WindowsSDK Documentation you can find more good examples.

    Regards,

    Wednesday, June 21, 2006 2:02 AM
  • Sorry, I guess I didn't make my self very clear. Please forget the console based application, I got it running.

    What I really want to do it to get the "Getting Started" sample running. (I believe this one is supposed to run on IIS isn't it?)

    I found it under windows SDK -> technology samples -> basic -> Getting Started

    And I rebuilt the project fine, but I cannot find any service.exe even though it creates client.exe

    Does anyone know why? and if you can find good introduction to this sample code(like what it actually is doing) please let me know.

    Thanks.

    Wednesday, June 21, 2006 2:55 AM
  • My opinion is that the samples should just build and run as is with no external dependencies. I think both the server and client should be executables (console, most likely) because it is too much of a pain just playing around with the samples otherwise.

    I ended up just looking at the code instead of actually running it.

    My $0.02,
    Kent

    Wednesday, June 21, 2006 4:19 AM
  • Hi, Kent
    I know it's supposed to.
    And it surely compiles without error, however, as I said, it doesn't produce any service.exe
    as far as I can see.
    So if you can spare time and see if it produces service.exe or not, that would be greatly appreciated.
                
    Wednesday, June 21, 2006 5:22 AM
  • Hi - sorry to add to the confusion :)

    I was just stating that I too have found that the service implementation in the samples is not always an executable. I think it should be so that the samples are easier to run. I don't think there's any advantage to requiring IIS to host the sample - it just confuses matters and distracts from the subject of the sample.

    Kent

    Wednesday, June 21, 2006 6:14 AM
  • You can find a self hosted sample under

    Basic\Service\Hosting\SelfHost

    I agree with you this sample should be in the "getting started" folder, and not the IIS hosted one.

    Wednesday, June 21, 2006 9:15 AM
  • Hiro,

    You can find the "Getting Started" sample readme here[1].  Alternatively you can find the readme in the SDK which you can install from here [2].  If you haven't done so already, but sure to run Setup\CS\setupvroot.bat.  This will create the virtual directories needed by web hosted samples.

    Thanks.

    [1] http://windowssdk.msdn.microsoft.com/en-us/library/ms751519(VS.80).aspx

    [2] http://www.microsoft.com/downloads/details.aspx?FamilyId=13F8E273-F5EA-4B7B-B022-97755838DB94&displaylang=en

    Wednesday, June 21, 2006 9:08 PM
  • Hi, Ed

    Well, thanks for the info.

    I have SDK installed already and I was using the "Getting Started" sample from there.

    And it compiles no problem. The problem I'm struggling with right now is that when I build the sample, I can not find the "service.exe" anywhere. Or is it the way supposed to be? I can find the "client.exe" but not "service.exe" so I can not run the program.

    If anyone knows what I'm talking about and know the solution, please help me out. I've been struggling with this "Getting Started" sample, and trying to figure this baby out for like 3 weeks now. Still, I have no clue where the service.exe is. Thank you so much for your time.

    Thursday, June 22, 2006 1:31 AM
  • As I wrote before, a sample with "service.exe" can be found in Basic\Service\Hosting\SelfHost

    Seems the "getting started" sample produces a dll for use with IIS.

    Thursday, June 22, 2006 7:34 AM
  • Sorry for my very limited knowledge.

    But getting started sample produces a dll for IIS, how do I run the service on IIS?

    I guess that's what I don't understand still. How do we run the service on IIS without .exe file?

    Thanks for your time and patience.

    Thursday, June 22, 2006 10:05 AM
  • Hi,

    Thanks for your reply.

    I've read the pages before but my question is when you get to step three, it is blank.

    After you click, property-> security, I don't know what to do there cause it's left blank.

    Do you have any idea what I'm supposed to do?

    Right now, I got .asp file working but not .svc file at all. I get an error like

    The type 'Microsoft.ServiceModel.Samples.CalculatorService', provided as the Service attribute value in the ServiceHost directive could not be found.

    I think it has definitely something to do with Windows Vista which I'm currently using too.

    Any help would be greatly appreciated.

    Thanks.

    Friday, June 23, 2006 1:16 AM
  • This error occurs when the type specified in the svc file can't be found.  I would check and make sure that the service.dll has been placed in \inetpub\wwwroot\ServiceModelSamples\bin.

    Thanks

    Friday, June 23, 2006 9:15 PM
  •  kawano1h wrote:

    The type 'Microsoft.ServiceModel.Samples.CalculatorService', provided as the Service attribute value in the ServiceHost directive could not be found.

     

    It turns out microsoft's setupvroot.bat does not properly configure the virtual directory. I have been able to get this to run using the following steps.

     

    1) Remove the ServiceModelSample from IIS.

    2) Make sure to delete the directory ServiceModelSample from your inetpub\wwwroot directory as it is not needed.

    3) Right click the service project within the GettingStarted solution and select properties.

    4) Select the Build Events section and remove all the code within the Post-build event command line section.

    5) Select the Build section and ensure the Output path is set to bin\. Now close the service properties.

    6) Now we need to set up a virtual directory in IIS.

    7)  Expand the nodes of the tree control in the left-hand pane until the node named, Default Web Site becomes visible.

    8) Right-click on that node, and choose New|Virtual Directory from the context menu that appears. 

    9)   In the Virtual Directory Creation Wizard, enter, ServiceModelSample in the Virtual Directory alias screen.

    10)  Enter, the path of your service Example: "C:\GettingStarted\CS\service" on the Web Site Content Directory screen of the wizard. 

    11) Select the Read, and Run Scripts permissions on the wizard’s Virtual Directory Access Permissions screen, then click on the button labeled, Next, and follow the instructions to exit from the wizard. 

    12) Click Start|Run and type in http://localhost/servicemodelsample/service.svc

    It should display something similar to the text below.

     

    EDIT: Please note you must give access to the directory where your service directory is located or you will receive security issues. Give access to Everyone or Users.

     

    You have created a service.

    To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

     

    svcutil.exe http://xp-walters/ServiceModelSample/service.svc?wsdl

    This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:


    C#

    class Test
    {
        static void Main()
        {
            CalculatorClient client = new CalculatorClient();

            // Use the 'client' variable to call operations on the service.

            // Always close the client.
            client.Close();
        }
    }

     

    Visual Basic

    Class Test
        Shared Sub Main()
            Dim client CalculatorClient = New CalculatorClient()
            ' Use the 'client' variable to call operations on the service.

            ' Always close the client.
            client.Close()
        End Sub
    End Class

    Wednesday, September 27, 2006 9:22 PM
  • I was running Windows Vista when i was facomg this same issue... I created the virtual directory myself and tried this... later i found that I have make it as a application... so i opened Inetmgr and did "Convert to application" ( btw IIS 7 lookes good:) )

    hope this helps.

    Sunday, October 22, 2006 5:47 PM
  • After running the setupvroot.bat everything should work fine.

    When compiling the service-project, the post-build actions automatically deploy the service in IIS. If you changes any of your IIS-settings, like the 'home-directory' for 'Default website', it probably doesn't work anymore. In that case, check the post-build actions and correct them accordingly.

    Monday, November 13, 2006 7:54 PM

  • I had to:
    - remove post-build things mentioned above
    - move the entire project in wwwroot , otherwise I was told that my web.config cannot be read
    - make that an app not a virtual directory.
    .........
    ..and I grew some white hair

    Anyway, thanks for the posts, it would have taken me one more day without them..
    Wednesday, January 16, 2008 2:41 PM
  •  

    Check that all below should be similar

     

    Service="GeometryService" in svc file

     

    service name="GeometryService" in config file

     

    and the class name you are exposing should be equal.

     

    Thanks,

    Vijay

    Wednesday, April 23, 2008 4:29 PM
  •  
    Muthukumar.Krithivasan said:

    I was running Windows Vista when i was facomg this same issue... I created the virtual directory myself and tried this... later i found that I have make it as a application... so i opened Inetmgr and did "Convert to application" ( btw IIS 7 lookes good:) )

    hope this helps.



    Identical problem on W2k8, the host had only the Service.svc (and the correct settings within the <system.serviceModel> section from the web.confing) and the external wcf library was referenced by the web project. Build of the project placed the MyExternalWcfLibrary.dll within the Bin folder as it was expected but an attempt to access the  ulr

    https://localhost/MyIIS7HostVirtualDirectory/Service.svc

    simply returned the error

    The type ‘NamespaceOfMyServiceType.MyServiceType', provided as the Service attribute value in the ServiceHost directive could not be found.

    Than, converting the Virtual Directory into the Application and no other changes fixed this.
    Not sure why.

    Wednesday, October 22, 2008 10:41 AM
  •  I had a similar problem and there were two things I had to do:


     1.) the dll that my web service project created had to be dragged over to the bin directory of the web-site-to-which-I-was-deploying.  (The reason I hadnt done this was that "Microsoft .NET Framework 3.5 - Windows Communication Foundation" (p.106) had said that was optional.

     2.) when it came time to create a Service Reference in the VS 2008 I was using the IP number like

     http://123.123.12.1/Service1.svc/wsdl   and I needed to use

     http://www.MyDomainName.com/Service1.svc?wsdl

    btw, I got that correct url when I browsed to http://123.123.12.1/Service1.svc  The IP worked in that case.


                            
    HTH

    Friday, May 22, 2009 5:58 PM