.ben
01-15-2009, 03:39 PM
What exactly do I need to do to host a service which was created by the ServiceExporter?
I think I've set up everything as it should but the problem that arrises is how to get the "output" from the exporter to the ServiceHostFactoryObject.
When I use the attributes on the classes and interfaces, so not using the exporter, I can get it running. But I want to omit the attributes, well those that can be added by the exporter, and use an approach similar to 'normal' webservice exporting.
Sample configs below.
<object id="OpcService" type="Service.OpcService, Service" singleton="false">
</object>
<object id="OpcServiceExporter" type="Spring.ServiceModel.ServiceExporter, Spring.Services">
<property name="TargetName" value="OpcService"/>
<property name="Name" value="OpcService"/>
<property name="Namespace" value="http://ServiceNamespace/"/>
<property name="ConfigurationName" value="OpcService"/>
<property name="CallbackContract" expression="T(ServiceContract.ICallback)"/>
<property name="TypeAttributes">
<list>
<object type="System.ServiceModel.ServiceBehaviorAttribute, System.ServiceModel">
<property name="ConcurrencyMode" value="Multiple"/>
<property name="InstanceContextMode" value="Single"/>
</object>
</list>
</property>
</object>
<object id="OpcServiceHost" type="Spring.ServiceModel.Activation.ServiceHostFactoryO bject, Spring.Services">
<property name="TargetName" value="OpcService" />
</object>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding1">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="OpcService" behaviorConfiguration="DefaultBehavior">
<endpoint address="net.tcp://localhost:8000/Services/opcservice"
binding="netTcpBinding" bindingConfiguration="netTcpBinding1"
contract="ServiceContract.IOpcService" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8010/Services/opcservice"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I think I've set up everything as it should but the problem that arrises is how to get the "output" from the exporter to the ServiceHostFactoryObject.
When I use the attributes on the classes and interfaces, so not using the exporter, I can get it running. But I want to omit the attributes, well those that can be added by the exporter, and use an approach similar to 'normal' webservice exporting.
Sample configs below.
<object id="OpcService" type="Service.OpcService, Service" singleton="false">
</object>
<object id="OpcServiceExporter" type="Spring.ServiceModel.ServiceExporter, Spring.Services">
<property name="TargetName" value="OpcService"/>
<property name="Name" value="OpcService"/>
<property name="Namespace" value="http://ServiceNamespace/"/>
<property name="ConfigurationName" value="OpcService"/>
<property name="CallbackContract" expression="T(ServiceContract.ICallback)"/>
<property name="TypeAttributes">
<list>
<object type="System.ServiceModel.ServiceBehaviorAttribute, System.ServiceModel">
<property name="ConcurrencyMode" value="Multiple"/>
<property name="InstanceContextMode" value="Single"/>
</object>
</list>
</property>
</object>
<object id="OpcServiceHost" type="Spring.ServiceModel.Activation.ServiceHostFactoryO bject, Spring.Services">
<property name="TargetName" value="OpcService" />
</object>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding1">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="OpcService" behaviorConfiguration="DefaultBehavior">
<endpoint address="net.tcp://localhost:8000/Services/opcservice"
binding="netTcpBinding" bindingConfiguration="netTcpBinding1"
contract="ServiceContract.IOpcService" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8010/Services/opcservice"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>