How to configure WCF service or IIS to handle a large amount parameters? - wcf

I am using .NET 3.5 framework and I have large amount of parameters passing to my wcf:
Is there any configuration I can set either in the web.config or IIS?
http://localhost:61819/Services/IRAWorkLoad.svc/GetDLNs?sEcho=1&iColumns=23&sColumns=%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C&iDisplayStart=0&iDisplayLength=100&mDataProp_0=0&sSearch_0=&bRegex_0=false&bSearchable_0=true&bSortable_0=true&mDataProp_1=1&sSearch_1=&bRegex_1=false&bSearchable_1=true&bSortable_1=true&mDataProp_2=2&sSearch_2=&bRegex_2=false&bSearchable_2=true&bSortable_2=true&mDataProp_3=3&sSearch_3=&bRegex_3=false&bSearchable_3=true&bSortable_3=true&mDataProp_4=4&sSearch_4=&bRegex_4=false&bSearchable_4=true&bSortable_4=true&mDataProp_5=5&sSearch_5=&bRegex_5=false&bSearchable_5=true&bSortable_5=true&mDataProp_6=6&sSearch_6=&bRegex_6=false&bSearchable_6=true&bSortable_6=true&mDataProp_7=7&sSearch_7=&bRegex_7=false&bSearchable_7=true&bSortable_7=true&mDataProp_8=8&sSearch_8=&bRegex_8=false&bSearchable_8=true&bSortable_8=true&mDataProp_9=9&sSearch_9=&bRegex_9=false&bSearchable_9=true&bSortable_9=true&mDataProp_10=10&sSearch_10=&bRegex_10=false&bSearchable_10=true&bSortable_10=true&mDataProp_11=11&sSearch_11=&bRegex_11=false&bSearchable_11=true&bSortable_11=true&mDataProp_12=12&sSearch_12=&bRegex_12=false&bSearchable_12=true&bSortable_12=true&mDataProp_13=13&sSearch_13=&bRegex_13=false&bSearchable_13=true&bSortable_13=true&mDataProp_14=14&sSearch_14=&bRegex_14=false&bSearchable_14=true&bSortable_14=true&mDataProp_15=15&sSearch_15=&bRegex_15=false&bSearchable_15=true&bSortable_15=true&mDataProp_16=16&sSearch_16=&bRegex_16=false&bSearchable_16=true&bSortable_16=true&mDataProp_17=17&sSearch_17=&bRegex_17=false&bSearchable_17=true&bSortable_17=true&mDataProp_18=18&sSearch_18=&bRegex_18=false&bSearchable_18=true&bSortable_18=true&mDataProp_19=19&sSearch_19=&bRegex_19=false&bSearchable_19=true&bSortable_19=true&mDataProp_20=20&sSearch_20=&bRegex_20=false&bSearchable_20=true&bSortable_20=true&mDataProp_21=21&sSearch_21=&bRegex_21=false&bSearchable_21=true&bSortable_21=true&mDataProp_22=22&sSearch_22=&bRegex_22=false&bSearchable_22=true&bSortable_22=true&sSearch=&bRegex=false&iSortCol_0=0&sSortDir_0=asc&iSortingCols=1&assignType=1
My web.config:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="Treasury.IRS.HCTC.IRAWorkload.Web.Services.IRAWorkLoadAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="Treasury.IRS.HCTC.IRAWorkload.Web.Services.IRAWorkLoad">
<endpoint address="" behaviorConfiguration="Treasury.IRS.HCTC.IRAWorkload.Web.Services.IRAWorkLoadAspNetAjaxBehavior"
binding="webHttpBinding" contract="Treasury.IRS.HCTC.IRAWorkload.Web.Services.IRAWorkLoad" />
</service>
</services>
</system.serviceModel>

Related

Metadata doesn't appear

I'm trying to create a WCF service, but the metadata doesn't appear, i try:
<system.serviceModel>
<services>
<service
name ="MyNamespace.IMyContract"
behaviorConfiguration="mex">
<endpoint
address = ""
binding = "wsHttpBinding"
contract = "MyNamespace.IMyContract"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mex">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
I try to access with http://MyServer/receptor.svc but shows that Metadata publishing for this service is currently disabled. and http://MyServer/mex shows 404, why? What am i doing wrong?
OBS1: i publish my service in IIS7.5 on Windows 7.
OBS2: if i remove behaviorConfiguration="mex" the metadata works, but with basicHttpBinding not with wsHttpBinding.
I forget to put:
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />

WCF Default Endpoint Missing

I am deploying a WCF Service to IIS 7 and when I navigate to the service URL I get a page like this:
I do not get the typical landing page like this (copied from the web just to show example, data blurred to protect the innocent):
Can someone tell me what I am doing wrong? The service works as expected but there is nothing for a user of this service to view to know what the methods are or where to get the WSDL.
Here are my relevant files:
App.Config (in service project and copied to service site as Web.Config for IIS)
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<services>
<service name="MyService.MyService" behaviorConfiguration="Web">
<clear />
<endpoint address=""
binding="wsHttpBinding"
name="ws"
behaviorConfiguration="Web"
contract="MyService.IMyService" />
<!--
<endpoint address=""
behaviorConfiguration="Web"
binding="webHttpBinding"
bindingConfiguration=""
name="web"
contract="MyService.IMyService" />
-->
<host>
<baseAddresses>
<add baseAddress="http://services.mydomain.com/MyService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Web">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Web">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
MyService.svc
<%# ServiceHost Service="MyService.MyService"
Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
I also tried using 'webHttpBinding' instead of 'wsHttpBinding' and it didn't seem to make a difference.
ServiceHost Service="MyService.MyService" ... is this line correct?

Azure web service URL issue

I wrote a simple webget service , added this code at web.config..
Then in order to access it i had to type this http://127.0.0.1/service1.svc/data?value=4
I searched all the config files but couldnt find how to get rid of service1.svc part..
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="webby">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="WCFServiceWebRole1.Service1" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint
address="/"
binding="webHttpBinding"
contract="WCFServiceWebRole1.IService1"
behaviorConfiguration="webby"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
If you're on Azure, you'll most likely be hosting on IIS.
This article: http://social.technet.microsoft.com/wiki/contents/articles/hosting-a-wcf-rest-service-on-iis.aspx explains nicely how to use ASP.NET routing to re-route requests for Service1.svc to your service.

WCF Metadata publishing for this service is currently disabled

I am struggling to display metadata while using WCF.
I have looked all over the place. I'm not sure if it is a setting in my web.config file, or my actual service is not working properly. But I get the "Metadata publishing for this service is currently disabled." page when I debug.
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="myWebHttp"/>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="EDSCoastmap">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttp">
<webHttp/>
</behavior>
<behavior name="jsonWebHttp">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="EDSCoastmap" name="EDS_CoastmapRest.EDSCoastmap">
<endpoint behaviorConfiguration="webHttp" binding="webHttpBinding"
bindingConfiguration="myWebHttp" contract="EDS_CoastmapRest.IEDSCoastmap" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>
Your service doesn't have SOAP endpoint so there are no valid metadata to be exposed. You don't need neither serviceMetadata behavior or MEX endpoint if you don't have SOAP service.
Btw. how do you debug the service?

WCF MetaData not working

I have tried several times to have my WCF service expose MetaData. Instead, I keep keeping the exception:
The contract name 'IMetadataExchange'
could not be found in the list of
contracts implemented by the service
SecurityBroker. Add a ServiceMetadataBehavior to the
configuration file or to the
ServiceHost directly to enable support
for this contract.
... when manually browsing to the service using IE.
(I am presuming this is the same reason why my client application isn't able to generate a service reference. Baby steps and all)
And yet my web.config looks okay:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="webHttpEnablingBehaviour">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webHttpEnablingBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="IWW.MIGTurbo2.WCF.Security.SecurityBroker">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration="default"
contract="IWW.MIGTurbo2.WCF.Security.ISecurityBroker"
behaviorConfiguration="webHttpEnablingBehaviour">
</endpoint>
</service>
</services>
<client />
<bindings>
<webHttpBinding>
<binding name="default" />
</webHttpBinding>
</bindings>
</system.serviceModel>
So I have my IMetadataExchange contract defined with mex fine, and hooked up, as far as I can see. Have I missed something daft?
Edit
My Service definition is shown below, if this is useful:
<%# ServiceHost Language="C#" Debug="true" Service="IWW.MIGTurbo2.WCF.Security.SecurityBroker" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>
Your config file has the behaviorConfiguration attribute on the "endpoint" element, but you also need it on the "service" element.
I am using NetTcpBinding for all. In my case I was having the same issue and resolved it by adding:
(a) a behaviorConfiguration="" to the mex endpoint
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" behaviourConfiguration="" />
(b) a behaviorConfiguration="mex" to the service definition:
<services>
<service name="AcmeService" behaviorConfiguration="mex">
(c) The behaviour entry
<behaviors>
<serviceBehaviors>
<behaviour name="mex">
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>