Hi - you also asked this on stackoverflow, and I asked you a few questions
- can you answer them? Ta

http://stackoverflow.com/questions/17173588/protobuf-wcf-no-model-instance-has-been-assigned

Marc
On 19 Jun 2013 21:59, "Andrew McCormack" <mccor...@gmail.com> wrote:

> I am getting this error:
>
> No Model instance has been assigned to the ProtoOperationBehavior
>
> I just used the WCF template application in Visual Studio to see if I
> could get it running.    How do I fix this error?
>
> *Code*
>
>     public class Service1 : IService1
>     {
>         public string GetData(int value)
>         {
>             return string.Format("You entered: {0}", value);
>         }
>
>         public CompositeType GetDataUsingDataContract(CompositeType
> composite)
>         {
>             if (composite == null)
>             {
>                 throw new ArgumentNullException("composite");
>             }
>             if (composite.BoolValue)
>             {
>                 composite.StringValue += "Suffix";
>             }
>             return composite;
>         }
>     }
>
>     [ServiceContract]
>     public interface IService1
>     {
>
>         [OperationContract]
>         [ProtoBehavior()]
>         string GetData(int value);
>
>         [OperationContract]
>         [ProtoBehavior()]
>         CompositeType GetDataUsingDataContract(CompositeType composite);
>     }
>
>
>     [DataContract]
>     [ProtoBuf.ProtoContract]
>     public class CompositeType
>     {
>         bool boolValue = true;
>         string stringValue = "Hello ";
>
>         [DataMember(Order = 1)]
>         [ProtoBuf.ProtoMember(1)]
>         public bool BoolValue
>         {
>             get { return boolValue; }
>             set { boolValue = value; }
>         }
>
>         [DataMember(Order = 2)]
>         [ProtoBuf.ProtoMember(2)]
>         public string StringValue
>         {
>             get { return stringValue; }
>             set { stringValue = value; }
>         }
>     }
>
> *web.config*
>
>   <system.serviceModel>
>     <bindings>
>       <wsHttpBinding>
>         <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
>           openTimeout="00:01:00" receiveTimeout="00:10:00"
> sendTimeout="00:01:00"
>           bypassProxyOnLocal="false" maxBufferPoolSize="524288"
> maxReceivedMessageSize="65536"
>           useDefaultWebProxy="true" allowCookies="false" />
>       </wsHttpBinding>
>     </bindings>
>     <client>
>       <endpoint address="" behaviorConfiguration="protoEndpointBehavior"
>         binding="wsHttpBinding"
> bindingConfiguration="WSHttpBinding_IService1"
>         contract="ServiceReference1.IService1"
> name="WSHttpBinding_IService1">
>       </endpoint>
>       <endpoint address="mex" binding="mexHttpBinding"
>         bindingConfiguration="" contract="WcfService1.IService1"
> name="mex" />
>     </client>
>     <behaviors>
>       <serviceBehaviors>
>         <behavior>
>           <serviceMetadata httpGetEnabled="true"/>
>         </behavior>
>       </serviceBehaviors>
>       <endpointBehaviors>
>         <behavior name="protoEndpointBehavior">
>           <protobuf/>
>         </behavior>
>       </endpointBehaviors>
>     </behaviors>
>     <extensions>
>       <behaviorExtensions>
>         <!--<add name="protobuf"
> type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net,
> Version=2.0.0.621, Culture=neutral, PublicKeyToken=257b51d87d2e4d67"/>-->
>         <add name="protobuf"
> type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net,
> Version=2.0.0.640, Culture=neutral, PublicKeyToken=257b51d87d2e4d67" />
>       </behaviorExtensions>
>     </extensions>
>   </system.serviceModel>
>
> client:
>
>             BasicHttpBinding http = new BasicHttpBinding();
>             ChannelFactory<ProtoBufWebService.IService1> channel = new
> ChannelFactory<ProtoBufWebService.IService1>(http, "
> http://localhost/ProtoWebService/Service1.svc";);
>             channel.Endpoint.EndpointBehaviors.Add(new
> ProtoBuf.ServiceModel.ProtoEndpointBehavior());
>             channel.Open();
>             ProtoBufWebService.IService1 client = channel.CreateChannel();
>             ProtoBufWebService.CompositeType c = new
> ProtoBufWebService.CompositeType();
>             c.BoolValue = true;
>             c.StringValue = "yes";
>             string result = client.GetData(0);
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to