We have a C# Web Service that declares itself using attributes. The code-behind file looks like:
[WebService(Namespace = "http://the.web.service.url/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public sealed class TheWebservice : WebService
{
[WebMethod]
public SomeObject TheFunction()
...
The web services has worked for a long time now. Recently, one request resulted in an error:
The maximum string content length quota (8192) has been exceeded while reading XML data.
After searching around, I found that there is a setting maxStringContentLength that can increase the meaximum size. The post says you can configure this setting in Web.config in the BasicHttpBinding
section. You can then specify that BasicHttpBinding
in an endpoint
section. But since we declare the webservice using the WebService
attribute in the code-behind file, we do not have an endpoint
section.
Is there a way to specify an endpoint using a declarative attribute? Alternatively, is it possible to switch from attribute to web.config mode without breaking existing clients? Am I confusing WCF and its predecessor here?