I want to publish a Webservice with basicHttpBinding configuration. I am using a basicHttpBinding configuration to increase the default message size of 65536 bytes. The problem I am having is that when I use the web.config settings as shown below, I am getting an error:
Metadata publishing for this service is currently disabled.
My Main goal is to be able to increase the default message size and able to save binary file in database, therefore any other config is welcome, however I was trying to keep it as simple as possible to avoid further issues.
Can you please spot what is wrong with my configuration?
Service.config code is below..
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpEndpointBinding" closeTimeout="01:01:00"
openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="StreamedRequest"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" maxArrayLength="2147483646"
maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WITSService.WITSService" behaviorConfiguration="DragDrop.Service.ServiceBehavior" >
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpEndpointBinding" contract="DragDrop.Service.IService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<!--<services>
<service name="WITSService.WITSService">
<endpoint address="" binding="basicHttpBinding" contract="WITSService.WITSService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" />
</service>
</services>-->
<behaviors>
<serviceBehaviors>
<behavior name="DragDrop.Service.ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="500000000" />
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
Put this configuration in your web.config.
<?xml version="1.0"?>
<configuration>
<system.web>
<httpRuntime executionTimeout="4800" maxRequestLength="2097150"/>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding/>
<customBinding>
<binding name="LargeSilverlight" closeTimeout="00:21:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:50:00">
<textMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</textMessageEncoding>
<httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
<client/>
<!--SERVICE-->
<services>
<service name="WITSService.WITSService" behaviorConfiguration="SilverlightWCFLargeDataApplication">
<endpoint address="" binding="customBinding" bindingConfiguration="LargeSilverlight" behaviorConfiguration="SilverlightWCFLargeDataApplication" contract="DragDrop.Service.IService"/>
</service>
</services>
<!--BEHAVIOR-->
<behaviors>
<serviceBehaviors>
<behavior name="SilverlightWCFLargeDataApplication">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="SilverlightWCFLargeDataApplication">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="500000000"/>
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Related
I have the next problem:
I have a reference to a web service, my app.config is alright and in my asp.net, visual basic code works perfect, but executing the .exe file I get the message "could not find default endpoint element that references contract in the servicemodel..."
this is and extract of my app.config:
<endpoint address="http://ADDRESS/AutenticaService.svc"
binding="basicHttpBinding" bindingConfiguration="AutenticaEndpoint"
contract="AutenticaService.AutenticaServiceContract" name="AutenticaEndpoint"/>
any clue?.. thanks in advance
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="SISEPrueba.My.MySettings.ChRiesgos_ProdConnectionString"
connectionString="Data Source=CBRTPWPAPL201;Initial Catalog=CHUBB_SEG_REPORTES;User ID=user_rpt;password=xxxx"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="myBehavior">
<callbackDebug includeExceptionDetailInFaults="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="AutenticaEndpoint" >
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://ADDRESS/ServicioSeguridad/AutenticaService.svc"
binding="basicHttpBinding" bindingConfiguration="AutenticaEndpoint"
contract="AutenticaService.AutenticaServiceContract" name="AutenticaEndpoint"/>
</client>
</system.serviceModel>
</configuration>
When using firebug, I got this wired error "NetworkError: 415 Cannot process the ...xt/xml; charset=utf-8 in my asp.net project.
Interface is below
[OperationContract]
[FaultContract(typeof(string))]
[WebInvoke(Method="POST",
UriTemplate="Demand",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat=WebMessageFormat.Json)]
ClientResponse postdemand_data(List<demands> demanddata);
web config. we use following web config file in my service
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="LargeWebforHttp" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
<binding name="LargeWebforHttps" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DPintegrationHA_FromSR.Service1Behavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="" />
<serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="10000"
maxConcurrentInstances="10000" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DPintegrationHA_FromSR.Service1Behavior" name="DP_ITAPEDGE_HMview_wcf.Service1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeWebforHttp" contract="DP_ITAPEDGE_HMview_wcf.IService1" name="httpPoint">
</endpoint>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeWebforHttps" contract="DP_ITAPEDGE_HMview_wcf.IService1" name="httpsPoint">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
Ok. So I don't know what I am doing wrong, but I have tried a few things. There's even a few posts here about this very same problem, but seems like I just cannot get this right.
I have a website that is running rest services, and everything is working fine when I use normal "http".
So today I was like "...hey, let's enable SSL, because we will have to run the website with SSL anyways later on...", and this is what I did:
- Clicked on the project, and pressed F4 (open properties) and ->
Great. When I run the wesbite:
And this is what my serviceModel looks like:
<system.serviceModel>
<!--<services>
<service name="Stolen.Service">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="Stolen.IService"/>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>-->
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding>
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="Stolen.Service">
<endpoint address="rest"
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
behaviorConfiguration="RestfulBehavior"
contract="Stolen.IService"/>
<!--<endpoint address=""
binding="webHttpBinding"
behaviorConfiguration="RestfulBehavior"
contract="Stolen.IService"/>-->
<!--<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />-->
<!--<endpoint address="soap"
binding="basicHttpBinding"
behaviorConfiguration="SOAPBehavior"
contract="Stolen.IService" />-->
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="RestfulBehavior">
<!--<enableWebScript/>-->
<webHttp/>
</behavior>
<!--<behavior name="SOAPBehavior">
</behavior>-->
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
And one of the services that I have:
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "IncrementWebsiteVisitCount",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
string IncrementWebsiteVisitCount();
Some posts have suggested that the
<webHttp/>
be removed. Some also suggested that this is because I have configured a single endpointBehavior for both SOAP and REST endpoints. I dunno, this one gets me!
Can anyone perhaps help me out? Any help will be appreciated!
I actually ended up changing a few things.
But only in the web config file.
My serviceModel now looks like this:
<system.serviceModel>
<bindings>
<!-- As far as I know, webHttpBinding means it is a REST service -->
<webHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata 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>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="Stolen.Service">
<host>
<baseAddresses>
<add baseAddress="https://localhost:44300/Service.svc/" />
</baseAddresses>
</host>
<endpoint address=""
behaviorConfiguration="web"
binding="webHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="Stolen.IService" />
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
With this, everything is working fine for me now, with SSL.
I have a WCF service hosted on IIS and here is the web config.
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IFactoryData" allowCookies="true" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000" />
<binding name="BasicHttpBinding_IWatheq">
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="NetTcpBinding_IFactoryData" />
</netTcpBinding>
<wsHttpBinding>
<binding name="allowMax" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="200" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://eind.mci.gov.sa/FactoryWCF/FactoryData.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFactoryData" contract="MCI_FactoryData.IFactoryData" name="BasicHttpBinding_IFactoryData" />
<endpoint address="https://wathiqprep.thiqah.sa/2.0/Wathiq.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWatheq" contract="WatheqServiceRef.IWatheq" name="BasicHttpBinding_IWatheq" />
<!--<endpoint address="net.tcp://mci-inddb.mci.gov/FactoryWCF/FactoryData.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IFactoryData"
contract="MCI_FactoryData.IFactoryData" name="NetTcpBinding_IFactoryData">
<identity>
<servicePrincipalName value="host/MCI-INDDB.MCI.GOV" />
</identity>
</endpoint>-->
</client>
<behaviors>
<endpointBehaviors>
<behavior name="Web" />
</endpointBehaviors>
<serviceBehaviors>
<behavior name="mex">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="mex" name="SIDFService.FactoryService">
<endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.IFactoryService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="mex" name="SIDFService.WatheqService">
<endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.IWatheqService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="mex" name="SIDFService.TempIndustrialLicenseService">
<endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.ITempIndustrialLicenseService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="mex" name="SIDFService.SaudiPostAddressService">
<endpoint behaviorConfiguration="Web" binding="wsHttpBinding" bindingConfiguration="allowMax" contract="SIDFService.ISaudiPostAddressService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
The setting on IIS is anonymous is enabled and Windows is enabled ... the service wsdl is accessble outside the domain but on WCF test client it is asking for windows credentials. The same when windows is disabled on IIS authentication, the service gives error on browser outside domain.
I'm trying to add workflowControlEndpoint to my IIS hosted XAMLX service. I cannot reference the control endpoint from client, I keep getting the following error
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost/Test.xamlx/wce'.
Content Type application/soap+xml; charset=utf-8 was not supported by service 'http://mymachine/Test.xamlx/wce'. The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
I've the following web.config. Could someone point to me what I'm missing? Thanks and appreciate the help....
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" transferMode="StreamedResponse">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
<binding name="httpSecurityOff" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
transferMode="Streamed" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
<service name="Test">
<endpoint address="" binding="basicHttpBinding" contract="IService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="wce" binding="basicHttpBinding"
bindingConfiguration="httpSecurityOff"
contract="System.ServiceModel.Activities.IWorkflowInstanceMangement"
kind="workflowControlEndpoint" />
</service>
I was trying to get the IWorkflowInstanceManagement to work via the WCF Test Client, but I never could get it to find the metadata. So I just tried to communicate with it via code. It worked for me.
I created a new Workflow Service project, and my web.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=localhost\SQLEXPRESS;Initial Catalog=WFS;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="workflowBehavior">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="true" />
<sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll"
instanceEncodingOption="GZip"
instanceLockedExceptionAction="BasicRetry"
connectionStringName="ApplicationServices"
hostLockRenewalPeriod="00:00:20"
runnableInstancesDetectionPeriod="00:00:05" />
<workflowInstanceManagement authorizedWindowsGroup="AS_Administrators" />
<workflowUnhandledException action="Terminate" />
<workflowIdle timeToPersist="00:01:00" timeToUnload="00:01:00" />
</behavior>
<behavior name="wceBehavior">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="Service1" behaviorConfiguration="workflowBehavior">
<endpoint binding="basicHttpBinding" address="" contract="IService" />
<endpoint binding="basicHttpBinding" address="wce" kind="workflowControlEndpoint" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Then I created a console app with the following code (I know this is not the best way to use ChannelFactory):
var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
var channelFactory = new ChannelFactory<IWorkflowInstanceManagement>(binding);
var channel = channelFactory.CreateChannel(new EndpointAddress("http://localhost/WorkflowControlTest/Service1.xamlx/wce"));
channel.Cancel(new Guid("DE212DE0-6BFF-4096-BF30-F6ACB2923B50"));
My workflow just runs in a loop running a delay for a few minutes. I was able to start a workflow instance via the WCF Test Client, then grab the Workflow Instance ID from the persistence database, and then run the console app to cancel the workflow.
Go to "Control Panel > Programs and Features > Turn Windows Features on or off" and check if following features are checked:
.NET Framework 3.5
.NET Framework 4.5 Advanced Services > WCF Services