I am new to WCF and trying to troubleshoot an error. I have a WCF service running on a remote server and am receiving an error when another WCF service tries to call it running in my localhost.
The HTTP request to [url to the service] was aborted. This may be due to the local channel being closed while the request was still in progress. If this behavior is not desired, then update your code so that it does not close the channel while request operations are still in progress.
I tried looking at the activity in the Microsoft Service Trace Viewer and the first error received is:
Failed to lookup a channel to receive an incoming message. Either the endpoint or the SOAP action was not found.
I can see the service is running, I can access it in the browser.
Can anyone help point me in the right direction of anything I can try? The service that I am trying to connect to is called LinkTable and I have added the relevant config files.
Client web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.6"/>
<httpRuntime targetFramework="4.6"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyService" />
<binding name="BasicHttpBinding_IKeyLinkage" closeTimeout="00:25:00"
openTimeout="00:02:00" receiveTimeout="00:02:00" sendTimeout="00:02:00"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
<binding name="BasicHttpBinding_IMaintenance" />
</basicHttpBinding>
<wsHttpBinding>
<binding name="WSHttpBinding_L2" closeTimeout="00:25:00" openTimeout="00:02:00"
receiveTimeout="00:02:00" sendTimeout="00:02:00" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
<binding name="wsHttpBinding_IProcessXML" closeTimeout="00:25:00"
openTimeout="00:02:00" receiveTimeout="00:02:00" sendTimeout="00:02:00"
maxReceivedMessageSize="2147483647" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http:/path/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
contract="NotificationService.IMyService" name="BasicHttpBinding_IMyService" />
<endpoint address="http://path/Maintenance.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMaintenance"
contract="MaintenanceService.IMaintenance" name="BasicHttpBinding_IMaintenance" />
<endpoint address="http://path/Services/KeyLinkage.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IKeyLinkage"
contract="KeyLinkageService.IKeyLinkage" name="BasicHttpBinding_IKeyLinkage" />
<endpoint address="https://path/Services/LinkTableService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_L2"
contract="LinkTable_L2.ILinkTableService" name="WSHttpBinding_ILinkTableService" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="wsHttpBinding" scheme="http" bindingConfiguration="wsHttpBinding_IProcessXML"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
<source name="System.Runtime.Serialization" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="ServiceModelTraceListener" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="App_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp" />
</sharedListeners>
</system.diagnostics>
</configuration>
Server web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
</system.web>
<system.serviceModel>
<client>
<endpoint address="http://path/Services/LinkTable.svc" binding="basicHttpBinding" bindingConfiguration="AppName_WCF_BasicHttpBinding" contract="LinkTableWCF.ILinkTable" name="BasicHttpBinding_ILinkTable" />
</client>
<services>
</service>
<service behaviorConfiguration="AppName_L2_WCF_Behavior" name="AppName_L2_WCF.Services.LinkTableService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="AppName_L2_WCF_wsHttpBinding" contract="AppName_L2_WCF.ServiceContracts.ILinkTableService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="AppName_WCF_BasicHttpBinding" maxBufferPoolSize="819200" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
<wsHttpBinding>
<binding name="AppName_L2_WCF_wsHttpBinding" maxBufferPoolSize="819200" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="AppName_L2_WCF_Behavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="AppName_L2_WCF.Utils.ServiceAuthenticator, AppName_L2_WCF" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="wsHttpBinding" scheme="http" bindingConfiguration="AppName_L2_WCF_wsHttpBinding" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
Related
I'm having an issue with quota when I try to get the content of a file through my web service. I'm using windows services to start and maintenant the connection.
Here below is the message I get:
System.ServiceModel.CommunicationException: 'Error in deserializing body of reply message for operation 'GetFileContent'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.'
Here my config files:
Server WCF web.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="behavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="behavior.ShipperServiceEndPointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="behavior" name="MonitoringServer.MonitoringService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpbinding"
contract="MonitoringServer.IMonitoringService" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:54322/Monitoring" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="tcpbinding" closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionProtocol="OleTransactions"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
The server Windows service app.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="behavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="behavior.ShipperServiceEndPointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="MonitoringServer.MonitoringService" behaviorConfiguration="behavior">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpbinding" contract="MonitoringServer.IMonitoringService" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:54322/Monitoring" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="tcpbinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" closeTimeout="00:10:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking"/>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
preCondition="managedHandler"/>
</modules>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
Client A app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="c:\dev\monitoring\monitoring_new\client\monitoringclient\app_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
<appSettings>
<add key="WebServiceAddress" value="net.tcp://localhost:54322/Monitoring"/>
</appSettings>
<system.serviceModel>
<behaviors />
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMonitoringService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
hostNameComparisonMode="WeakWildcard" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
portSharingEnabled="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession enabled="true" />
<security mode="Message" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:54322/Monitoring" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IMonitoringService" contract="MonitoringServiceReference.IMonitoringService"
name="NetTcpBinding_IMonitoringService">
<identity>
<userPrincipalName value="DEV-JC-18\panipro" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Client "B" app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="WebServiceAddress" value="net.tcp://localhost:54322/Monitoring"/>
</appSettings>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMonitoringService" closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:54322/Monitoring" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IMonitoringService" contract="MonitoringServiceReference.IMonitoringService"
name="NetTcpBinding_IMonitoringService">
<identity>
<userPrincipalName value="DEV-JC-18\panipro" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Can someone just point out what I'm doing wrong ?
Thank's in advance.
I have implemented a WCF service for connecting c# project with SAP.
But I receive the following error when I try to start the service. The error is as follows
The content type text/html; charset=iso-8859-1 of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 442 bytes of the response were:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode> soap:Server </faultcode>
<faultstring xml:lang="en"> RABAX occurred on server side </faultstring>
<detail>
<sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic">
<SYDATUM>20170904</SYDATUM>
<SYUZEIT>152028</SYUZEIT>
<ERRORCODE>SYNTAX_ERROR</ERRORCODE>
</sap:Rabax>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The following is my IIS config file for the WCF Service.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<system.web>
<compilation targetFramework="4.5" />
<pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="CustomBehavior">
<clientCredentials>
<httpDigest impersonationLevel="None" />
</clientCredentials>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="CustomBinding_HTTP">
<binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="64" maxSessionSize="2147483647">
<readerQuotas maxDepth="300" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binaryMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
</binding>
<binding name="bindingBAPI" receiveTimeout="00:10:00" sendTimeout="00:05:00">
<mtomMessageEncoding messageVersion="Soap11"></mtomMessageEncoding>
<httpTransport authenticationScheme="Basic" realm="SAP NetWeaver Application Server[SC3/900]"></httpTransport>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="my end point address" binding="customBinding" bindingConfiguration="bindingBAPI" contract="ServiceReferenceBAPI.z_bedmanagement" name="BAPIEndpoint" />
</client>
<services>
<service name="Cerner.BM.Outbound.Service.BM_OutboundService">
<endpoint address="" binding="customBinding" bindingConfiguration="CustomBinding_HTTP" name="BM_OutboundService" contract="Cerner.BM.Outbound.Service.IBM_OutboundService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<!-- Client and institution value for successful BAPI Connection. -->
<appSettings>
<add key="BAPI_Client" value="" />
<add key="BAPI_Institution" value="" />
<add key="BAPI_UserName" value=""/>
<add key="BAPI_Password" value=""/>
</appSettings>
</configuration>
I get
"There was no endpoint listening at https://localhost/BassCoastServices/GeneralUtilityService.svc that
could accept the message. This is often caused by an incorrect address
or SOAP action. See InnerException, if present, for more details."
when I call the GeneralUtilityService from the client side and
"There was no channel actively listening at 'https://laura-laptop/BassCoastServices/GeneralUtilityService.svc'.
This is often caused by an incorrect address URI. Ensure that the
address to which the message is sent matches an address on which a
service is listening."
shows up when I debug w3wp.
Is there some sort of tool I can use that will make sure a client and server config file line up?
If this is an easy fix, please see the below App and Web config files.
App.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Username" value="sampleuser"/>
<add key="Password" value="samplepassword"/>
<add key="basePath" value="C:\Temp"/>
</appSettings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<wsHttpBinding>
<binding name="standardBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" allowCookies="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="01:00:00" enabled="false"/>
<security mode="TransportWithMessageCredential" >
<transport clientCredentialType="Certificate" proxyCredentialType="None" />
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<callbackDebug includeExceptionDetailInFaults="true"/>
<clientCredentials>
<clientCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
</clientCertificate>
</clientCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="https://localhost/BassCoastServices/GeneralUtilityService.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="standardBinding" contract="Adapt.WCF.IGeneralUtilityService" name="IGeneralUtilityServiceEndPoint">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>
Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
<add key="DatabaseConnectionString" value="Data Source=(local)\SQL2014;Initial Catalog=XIVICProduction;User ID=sa;Password=sameplepassword;MultipleActiveResultSets=True"/>
<add key="LogFilePath" value="C:\inetpub\wwwroot\Xivic\BassCoastServices\Log\Log.txt"/>
<add key="AllowMissingExternalIDs" value="true"/>
<!--No need to change-->
<add key="LogFileTypeLevel" value="Error"/>
<add key="SqlServerDateTimeStyle" value="103"/>
<add key="DatabaseType" value="Sql"/>
<add key="EnforceSecurityAtBusinessRulesLayer" value="false"/>
<add key="DateComparisonInaccuracy" value="35000"/>
<add key="CacheAccessItemsAtBusinessLayer" value="true"/>
<add key="CacheRecordsAtDataLayer" value="true"/>
<add key="SesionTimeout" value="1440"/>
</appSettings>
<system.serviceModel>
<services>
<!-- ENDPOINTS -->
<service name="IGeneralUtilityServiceEndPoint" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="wsHttpBinding" contract="Adapt.WCF.IGeneralUtilityService" bindingConfiguration="wsHttpEndpointBinding"/>
</service>
</services>
<!-- BEHAVIOURS -->
<behaviors>
<serviceBehaviors>
<behavior name="UserNameBehaviour">
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Adapt.WCF.Security.CustomUserNameValidator, Adapt.WCF" />
<serviceCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
</serviceCertificate>
</serviceCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<!-- BINDINGS -->
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "C:\inetpub\wwwroot\Xivic\BassCoastServices\Log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<!--startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
</startup-->
</configuration>
Calling WCF
_Channel = GetProxy<IGeneralUtilityService>();
_Channel.BeginTransaction(transactionId);
_Channel.CommitTransaction(transactionId);
public static T GetProxy<T>()
{
var channelFactory = new ChannelFactory<T>(string.Format("{0}EndPoint", typeof(T).Name));
channelFactory.Credentials.UserName.UserName = ConfigurationSettings.AppSettings["Username"];
channelFactory.Credentials.UserName.Password = ConfigurationSettings.AppSettings["Password"];
var workflowProxy = channelFactory.CreateChannel();
return workflowProxy;
}
Thanks in advance!
Update: I don't know what I did but now I'm getting
"Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost/BassCoastServices/GeneralUtilityService.svc. The client and service bindings may be mismatched."
Your problem is the way you create your channel factory. Some how it can not get the correct EndpointConfigurationName.
I'm not quite familiar on how to use only the EndpointConfigurationName as parameter in Channel Factory but you can try it this way:
var channelFactory = new ChannelFactory<T>("*", new EndpointAddress("https://localhost/BassCoastServices/GeneralUtilityService.svc"));
Well I don't know what the problem was but for anyone looking for a solution to this problem here are my web and app config files:
Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--Please configure-->
<!--Laura Local-->
<add key="DatabaseConnectionString" value="Data Source=(local)\SQL2014;Initial Catalog=XIVICProduction;User ID=sa;Password=samplepassword;MultipleActiveResultSets=True"/>
<!--No need to change-->
<add key="LogFilePath" value="C:\Temp\Log\log.txt" />
<add key="LogFileTypeLevel" value="Information" />
<add key="SqlServerDateTimeStyle" value="103" />
<add key="DatabaseType" value="Sql" />
<add key="EnforceSecurityAtBusinessRulesLayer" value="false" />
<add key="DateComparisonInaccuracy" value="35000" />
<add key="CacheAccessItemsAtBusinessLayer" value="true" />
<add key="CacheRecordsAtDataLayer" value="true" />
<!--Email Configuration-->
<!--add key="EmailAlertHost" value=""[INSERT="" HOST="" ADDRESS=""]/>
<add key="EmailAlertUsername" value=""[INSERT="" USERNAME=""]/>
<add key="EmailAlertPassword" value=""[INSERT="" PASSWORD=""] />
<add key="EmailAlertReplyToAddress" value=[INSERT REPLY TO ADDRESS] />
<add key="EmailAlertToAddress" value=""/>
<add key="EmailAlertCCAddress" value=""/>
<add key="EmailAlertSubject" value="*WARNING* - A Fatal Error Occurred # {0} - *WARNING*"/>
<add key="EmailAlertPriority" value="High"/-->
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<services>
<!--AssetInventoryService-->
<service name="Adapt.WCF.AssetInventory.AssetInventoryService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.AssetInventory.AssetInventoryService" bindingConfiguration="UserNameBinding" />
</service>
<!--AssetValuationUtilityService-->
<service name="Adapt.WCF.AssetValuation.AssetValuationUtilityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.IAssetValuationUtilityService" bindingConfiguration="UserNameBinding" />
</service>
<!--CodeGenerationService-->
<service name="Adapt.WCF.CodeGeneration.CodeGenerationService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.CodeGeneration.CodeGenerationService" bindingConfiguration="UserNameBinding" />
</service>
<!--CodeUtilityService-->
<service name="Adapt.WCF.CodeGeneration.CodeUtilityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.CodeGeneration.ICodeUtilityService" bindingConfiguration="UserNameBinding"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/CodeUtilityService.svc" />
</baseAddresses>
</host>
</service>
<!--DataSchemaService-->
<service name="Adapt.WCF.DataSchema.DataSchemaService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.DataSchema.DataSchemaService" bindingConfiguration="UserNameBinding" />
</service>
<!--DataTransactionService-->
<service name="Adapt.WCF.DataTransaction.DataTransactionService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.DataTransaction.DataTransactionService" bindingConfiguration="UserNameBinding" />
</service>
<!--GeneralUtilityService-->
<service name="Adapt.WCF.GeneralUtilityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.IGeneralUtilityService" bindingConfiguration="UserNameBinding"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/GeneralUtilityService.svc" />
</baseAddresses>
</host>
</service>
<!--SecurityService-->
<service name="Adapt.WCF.Security.SecurityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.Security.SecurityService" bindingConfiguration="UserNameBinding" />
</service>
<!--SyncService-->
<service name="Adapt.WCF.SyncService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.ISyncService" bindingConfiguration="UserNameBinding" />
</service>
<!--SystemSetupService-->
<service name="Adapt.WCF.SystemSetup.SystemSetupService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.SystemSetup.SystemSetupService" bindingConfiguration="UserNameBinding" />
</service>
<!--TaskManagementService-->
<service name="Adapt.WCF.TaskManagement.TaskManagementService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.TaskManagement.TaskManagementService" bindingConfiguration="UserNameBinding" />
</service>
</services>
<!-- BEHAVIOURS -->
<behaviors>
<serviceBehaviors>
<behavior name="UserNameBehaviour">
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Adapt.WCF.Security.CustomUserNameValidator, Adapt.WCF" />
<serviceCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
</serviceCertificate>
</serviceCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<!-- BINDINGS -->
<bindings>
<customBinding>
<binding name="UserNameBinding" closeTimeout="23:00:00" openTimeout="23:00:00" receiveTimeout="23:00:00" sendTimeout="23:00:00">
<security authenticationMode="SecureConversation" requireSecurityContextCancellation="true">
<secureConversationBootstrap authenticationMode="UserNameForSslNegotiated">
</secureConversationBootstrap>
</security>
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
<!--<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\temp\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>-->
</configuration>
App.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Username" value="dspec"/>
<add key="Password" value="samplepassword"/>
<add key="BasePath" value="c:\FileDrop"/>
</appSettings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<wsHttpBinding>
<binding name="standardBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" allowCookies="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="01:00:00" enabled="false"/>
<security mode="Message">
<transport clientCredentialType="Certificate" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<callbackDebug includeExceptionDetailInFaults="true"/>
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None"/>
</serviceCertificate>
</clientCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost/BassCoastServices/GeneralUtilityService.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="standardBinding" contract="Adapt.WCF.IGeneralUtilityService" name="IGeneralUtilityServiceEndPoint">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>
I have a windows service that is hosting a WCF Service on one machine on my network. I have a client that is trying to connect to it on another machine on the network. I am getting the following error when I connect and try to subscribe to the WCF service:
The request channel timed out while waiting for a reply after 00:00:09.9989999. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
I have added tracing to botht the client and service to try and figure out the problem, but I can't make sense of it.
Here is the Service app.config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="OSAERest.api" behaviorConfiguration="MyServiceBehavior">
<endpoint address="http://localhost:8732/api"
binding="webHttpBinding"
contract="OSAERest.IRestService"
behaviorConfiguration="WebHttp"/>
</service>
<service name="WCF.WCFService" behaviorConfiguration="WCFBehavior">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="WCFBinding" contract="WCF.IWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
bindingConfiguration=""
contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/Design_Time_Addresses/WCF/WCFService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="WCFBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
<serviceTimeouts transactionTimeout="05:05:00" />
<serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500"
maxConcurrentInstances="2147483647" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebHttp">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="WCFBinding">
<security mode="None">
</security>
</binding>
</wsDualHttpBinding>
</bindings>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
</assemblyBinding>
</runtime>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "Logs\ServiceTraces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
And here is the client app.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="ServiceIP" value="127.0.0.1"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib" />
</assemblyBinding>
</runtime>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IWCFService" closeTimeout="00:00:10"
openTimeout="00:00:10" receiveTimeout="00:00:10" sendTimeout="00:00:10"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None">
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8731/Design_Time_Addresses/WCF/WCFService/"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IWCFService"
contract="WCFService.IWCFService" name="WSDualHttpBinding_IWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "Logs\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
The trace on the Service shows the connection details coming from the client so it must be getting through somewhat. Also, When I run the client from the same machine as the service everything works perfectly. What could I possibly need to do to get remote connections to work?
This is most likely a firewall issue - wsDualHttpBinding tries to open a second connection from the server back to the client which is likely to be blocked by any firewall
NetTcpBinding is far more robust for duplex communication as I blogged here
I'm currently stacked with the web service that im creating right now. when Testing it in local it all works fine but when I try to deploy it to the web server it throws me the following error
An error occurred while trying to make a request to URI '...my web service URI here....'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
here is my web config.
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2000000000" />
</requestFiltering>
</security>
</system.webServer>
<connectionStrings>
<add name="........" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<!-- Testing -->
<add key="DataConnectionString" value="..........." />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<httpRuntime executionTimeout="1200" maxRequestLength="2000000" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="Service1">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2000000000" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="nextSPOTServiceBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2000000000" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="SecureBasic" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
<readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000"/>
</binding>
<binding name="BasicHttpBinding_IDownloadManagerService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="nextSPOTServiceBehavior" name="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.DownloadManagerService">
<endpoint binding="basicHttpBinding" bindingConfiguration="SecureBasic" name="basicHttpSecure" contract="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.IDownloadManagerService" />
<!--<endpoint binding="basicHttpBinding" bindingConfiguration="" name="basicHttp" contract="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.IDownloadManagerService" />-->
<!--<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDownloadManagerService" contract="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.IDownloadManagerService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />-->
</service>
</services >
</system.serviceModel>
</configuration>
Client access Policy
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
CROSS Domain policy
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain- policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
This sounds like the error you get when you are trying to use silverlight to access a webservice from where it is not hosted. If this is the case you need to add a clientaccesspolicy.xml to your web application folder.
MSDN article on allowing crossdomain access for a silverlight application.