Reputation: 1147
I'm Trying to add a service reference to a project that has another references already made. I've Copied the App.Config and Web.configs used in those Projects and adapted them to the service that I want to add. I also copied and adapted the contract and I believe I've done it well.
So my question is: What do you think that I possibly did wrong or common mistakes while adding a service reference or equally helpful where and how can I troubleshoot the problem about the error of adding a service reference to a project with mex endpoint?
The Error
Error Detailed
Aditional Info:
The contract as only one operation("start").
The connection is being made through net.tcp.
The Service and the Object are diferent projects.
The Object has an App.Config and the Service a Web.Config
UPDATE
Service Web.Config
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\inetpub\SocketListener\logs\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
</system.web>
<system.serviceModel>
<services>
<service name="SocketListener.SocketListener">
<endpoint address="" binding="netTcpBinding" contract="SocketListener.ISocketListener">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://<IP>/SocketListener/SocketListener.svc" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConf" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" hostNameComparisonMode="StrongWildcard" transactionFlow="false" transferMode="Buffered" maxBufferPoolSize="20000000"
maxBufferSize="20000000"
maxConnections="20000000"
maxReceivedMessageSize="20000000"
portSharingEnabled="true"
listenBacklog="20000000">
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>
Upvotes: -1
Views: 129
Reputation: 1147
This error was caused by miss configuration of the file *.svc and a miss configuration in IIS
File Miss Configuration
Wrong
<%@ ServiceHost Language="C#" Debug="true" Service="Service" %>
Correct
<%@ ServiceHost Language="C#" Debug="true" Service="<Namespace>.<Class used in the Service>" %>
IIS MissConfiguration
Wrong
in the application deployed in the IIS, in Advanced Settings, I Had http in the enabled protocols
Correct
in the application deployed in the IIS, in Advanced Settings, I changed to net.tcp in the enabled protocols
Upvotes: 0
Reputation: 13450
try to add behaviorConfiguration to service:
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\inetpub\SocketListener\logs\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
</system.web>
<system.serviceModel>
<services>
<service name="SocketListener.SocketListener" behaviorConfiguration="ServiceBeh">
<endpoint address="" binding="netTcpBinding" contract="SocketListener.ISocketListener">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://<IP>/SocketListener/SocketListener.svc" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConf" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" hostNameComparisonMode="StrongWildcard" transactionFlow="false" transferMode="Buffered" maxBufferPoolSize="20000000"
maxBufferSize="20000000"
maxConnections="20000000"
maxReceivedMessageSize="20000000"
portSharingEnabled="true"
listenBacklog="20000000">
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBeh">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>
Upvotes: 0