Ask a questionAsk a question
 

QuestionConfigure web.config for IIS to host DataService with net.tcp

  • Saturday, October 24, 2009 1:34 PMWindows Server 2008 User Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    [This post is regarding ADO.Net Data Services 1.5 CTP2]

    I'm doing some experiments with ADO.Net Data Services.  I'd like to host my service with IIS and use net.tcp binding. 

    I have created the data service and have configured IIS and the web application to use net.tcp, but I can't figure out how to activate the service.  My web.config looks like this:

    <system.serviceModel>
        <services>
          <service name="ServiceApp1.MyDataService">
            <endpoint address="net.tcp://localhost:50002/ServiceApp1/MyDataService1.svc"
              binding="netTcpBinding" bindingConfiguration="" contract="System.Data.Services.IRequestHandler" />
          </service>
        </services>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      </system.serviceModel>
    
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Data.Services" publicKeyToken="b77a5c561934e089"/>
            <bindingRedirect oldVersion="1.0.0.0-3.5.0.0" newVersion="4.0.0.0"/>
          </dependentAssembly>
         
        </assemblyBinding>
      </runtime>
    

    I keep receiving a ServiceActivationException like this:

    Exception: System.ServiceModel.ServiceActivationException: The service '/ServiceApp1/MyDataService1.svc' cannot be activated due to an exception during compilation. The exception message is: The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.. ---> System.InvalidOperationException: The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.Could someone please provide a sample web.config which shows how to host a data service with IIS on net.tcp?

     

All Replies