F# always implicitly implements interfaces so you need to cast to the interface before you can use it. This is why you see string names. This is okay for WCF.

I think the problem is you need to give names to the arguments on your interface. WCF uses reflection to find the names of the parameters and put them in the message. You add names using the following syntax:

1
2
3
4
5
6
7
[<ServiceContract>]

type IWebService =

    [<OperationContract; WebGet(UriTemplate = "{file}")>]

    abstract Get1: file:string -> Stream

Cheers,

Rob

By on 10/24/2008 6:59 AM ()

need to give names to the arguments on your interface. WCF uses reflection to find the names of the parameters and put them in the message. Cheers, Rob

Thanks for your answer first.

The Exception's message is my mother language and very short on my PC. The mean is:
Value can not be empty.
Parameter name: name

I am sorry for the word below. I'm not read your code clearly. Robert is right!

I think it's the reason that you say. But I try to add parameters to attribute of interface. Change parameter name and bindingname in config file. It's not work and jump the same exception many a time.

1
2
3
4
[<ServiceContract(Name = "IStringService")>]
type IStringService =
    [<OperationContract(Name = "GetString")>]
    abstract GetString :unit -> string

I cannot find any explain about Name property in MSDN.

By the way. If I donot define interface, add the attributes to class directly. Although it cannot listen multi endpoint. But it would work fine with one service and one endpoint.
So I think, the issue is INTERFACE

By on 10/24/2008 5:13 PM ()

The issue is the parameter name on methods in the interface.

In the example

1
2
abstract Get1: file:string -> Stream 

the key is "file:", it names the first string parameter. It's like "Get1(string file)" in C#. Without the "file:" bit, it's like "Get1(string _unnamed_)" in C#. WCF reflects on the name of the parameter in the interface, which means you need to give it a name in F#.

By on 10/24/2008 5:24 PM ()

F# always implicitly implements interfaces so you need to cast to the interface before you can use it. This is why you see string names. This is okay for WCF.

I think the problem is you need to give names to the arguments on your interface. WCF uses reflection to find the names of the parameters and put them in the message. You add names using the following syntax:

1
2
3
4
5
6
7
[<ServiceContract>]

type IWebService =

    [<OperationContract; WebGet(UriTemplate = "{file}")>]

    abstract Get1: file:string -> Stream

Cheers,

Rob

The issue is the parameter name on methods in the interface.

In the example

1
2
abstract Get1: file:string -> Stream 

the key is "file:", it names the first string parameter.  It's like "Get1(string file)" in C#.  Without the "file:" bit, it's like "Get1(string _unnamed_)" in C#.  WCF reflects on the name of the parameter in the interface, which means you need to give it a name in F#.

You are Right answer. Thank you very much to my dear Rob and brianmcn. My service has running!

Now I understood: Wcf let us define interface / class / config file. And then he reflects us assembly, read config, open port, listen client.

Reflect the World!

By on 10/24/2008 6:29 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper