Software architecture and development in .NET, SharePoint, SQL Server, Windows Server, Best Practices
štvrtok 21. júna 2012
piatok 8. júna 2012
WCF : Cannot have two operations in the same contract with the same name
WCF - over HTTP (and also Web Services in generaly) does not allow method overloading (it means :same method name but different atributes types, which is in C# absolutely correct).
This is example from my current project (in Slovak language)
Reason:
When
data is passed to an XML Web service it is sent in a request and when
it is returned it is sent in a response. Therefore, if an XML Web
service
contains two or more XML Web service methods with the same name, no
uniquely identification will be there. Hence it will produce error.
You should use OperationContract atribute "name" or simply rename one of the methods.
This is example from my current project (in Slovak language)
Code Snippet
- [OperationContract]
- APIVytvorDokumentResponse VytvorDokument(global::eDocsInterfaceCUD.CBO_API.CUD.MTOM.APIVytvorDokumentByteArrayRequest request);
-
[OperationContract(Name = "VytvorDokumentCezStream")] - APIVytvorDokumentResponse VytvorDokument(global::eDocsInterfaceCUD.CBO_API.CUD.MTOM.APIVytvorDokumentStreamRequest request);
pondelok 27. februára 2012
Error: The maximum message size quota for incoming messages (65536) has been exceeded.
This error has occurred, when I was calling simple method on WCF service.
I double checked my web.config on server side (IIS) and everything was fine.
But!!! the size 65536 was in client app.config! The client configuration was not reflecting server WCF configuration, changing maxReceivedMessageSize to e.g. 2147483647 is solution.
I double checked my web.config on server side (IIS) and everything was fine.
But!!! the size 65536 was in client app.config! The client configuration was not reflecting server WCF configuration, changing maxReceivedMessageSize to e.g. 2147483647 is solution.
Code Snippet
- <system.serviceModel>
- <bindings>
- <basicHttpBinding>
- <binding name="BasicHttpBinding_IeDocsInterfaceCUD" closeTimeout="00:10:00"
- openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
- allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
- maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
- messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"
- useDefaultWebProxy="true">
- <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
- maxBytesPerRead="4096" maxNameTableCharCount="16384" />
- <security mode="None">
- <transport clientCredentialType="None" proxyCredentialType="None"
- realm="" />
- <message clientCredentialType="UserName" algorithmSuite="Default" />
- </security>
- </binding>
piatok 24. februára 2012
Error : There was no endpoint listening... WCF
This error has occurred, when I was sending file to WCF service hosted on IIS 7, with more size than 30MB. There is a security limitation in IIS. After adding this lines in the web.config, the problem has been solved.
Code Snippet
- <system.webServer>
- <security>
- <requestFiltering>
- <requestLimits maxAllowedContentLength="2147483647" />
- </requestFiltering>
- </security>
- </system.webServer>
štvrtok 16. februára 2012
An error (The request was aborted: The request was canceled.) occurred while transmitting data over the HTTP channel.
I got this error when transmitting large file (byte array) to WCF service.
I double checked my web.config,
but sizing was good enough.
The problem is, that the WCF service is hosted on IIS and you need to configure quotas on two separated places!!
Add this:
Everything is working now..
Have a nice day!
I double checked my web.config,
Code Snippet
- <bindings>
- <basicHttpBinding>
- <binding
- name="BasicWithMtom"
- maxReceivedMessageSize="2621440"
- messageEncoding="Mtom">
- <readerQuotas maxArrayLength="2621440"/>
- </binding>
- </basicHttpBinding>
- </bindings>
but sizing was good enough.
The problem is, that the WCF service is hosted on IIS and you need to configure quotas on two separated places!!
Add this:
Code Snippet
- <system.webServer>
- <httpRuntime maxRequestLength="2621440" />
- </system.webServer>
Everything is working now..
Have a nice day!
pondelok 6. februára 2012
Favorite source code files in Visual Studio
Today I was looking for something like Bookmarks in Firefox or Favorites in IE, but right in the Visual Studio. I found, that it is not native function, but....
Visual Studio Extension called Favorite Documents is exactly, what i was looking for.
Enjoy:
Favorite Documents
Have a nice day!
Visual Studio Extension called Favorite Documents is exactly, what i was looking for.
Enjoy:
Favorite Documents
Have a nice day!
C# Code to HTML Converter
I used it in my last post.
It's Visual Studio 2010 Extension called Copy as HTMl.
Very simple to use - CTRL - C CTRL - V
It's Visual Studio 2010 Extension called Copy as HTMl.
Very simple to use - CTRL - C CTRL - V
Copy as HTML
Prihlásiť na odber:
Príspevky (Atom)





























