C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

Wednesday, December 31, 2014

Scenario
For uploading large files using WCF service, Microsoft recommends to use Stream objects and implement streamed transfer mode. We created a sample POC using
Message Contracts passing streams and writing a stream to a folder. We also created a Sample Console application to consume the WCF service and to write large files
to a folder. Both WCF service and Sample Console application were part of a single solution file.

Issue
We started the WCF service over the Visual Studio Development Server and then run the console application to test the WCF service. We repeatedly got the
following error:
The remote server returned an error: (400) Bad Request
We checked all the configurations in both Client and Service and everything was fine.  One major limitation was we were not able to debug the service, since it was
not hitting the breakpoint.

Resolution
We then hosted the WCF service on IIS and the service started working. We were able to debug the code and the functionality worked as expected.

The recommendation would be to always host WCF service on IIS, since there are some limitations while hosting it on File-System. When the WCF service is hosted
on File-System, we were unable to debug the code, even if we attach the process.  We were spending a lot of time in analysis and debugging even when there
was no issue.

Tuesday, October 14, 2014

SOLUTION 1:
Out the box MSI installers are discontinued from VSTS2012, so you won’t be able to use those, however you have option to revert back to VSTS 2010 just for deployment project.
For VSTS2012, I recommend using WIX, you could google out WIX, there is plenty of resources available. For quickstart below is some important WIX steps –
 
   <Directory Id="Example" Name=" Example ">
                 //copy all the Assemblies
            <Component Id='Copy Assemblies' Guid='{Enter your GUID}'>
              <File Id="Sample.dll" Source ="$(TargetDir)Sample.dll"/>
            </Component>
            </Directory>-->
           </Directory>
                 //copy all the Service specific files
          <Component Id='Copy Service File' Guid='{Enter your GUID}'>
            <File Id="Service1.svc" Source ="Service1.svc"/>
            <File Id="Web.Config" Source ="Web.config"/>
          </Component>
                 //Create IIS component like Application pool,website nd virtual directory
          <Component Id="IISComponent" Guid="{Enter your GUID}" KeyPath="yes">
            <iis:WebAppPool Id="WebAppPool" Name="ServicePool" ManagedRuntimeVersion="v4.0" IdleTimeout="0" RecycleMinutes="0" ManagedPipelineMode="integrated">
            </iis:WebAppPool>
            <iis:WebSite Id ='Service'  Directory ='INSTALLATION FOLDER' Description'Website Description'>
                <iis:WebAddress Id="AllUnassigned" Port="8019" />
            </iis:WebSite>
            <iis:WebVirtualDir Id="Virtual" Alias="VD" Directory="INSTALLATION FOLDER"  WebSite="Service">               
              <iis:WebApplication Id="MyWebAppApplication" WebAppPool="WebAppPool" Name="WebSiteVirtual" />
              <iis:WebDirProperties Id="MyWebSite_Properties" AnonymousAccess="yes" WindowsAuthentication="no" />
            </iis:WebVirtualDir>      
          </Component>
        </Directory>
 
 

SOLUTION 2:
n order to achieve this you can write your service as an Installer Class custom action and install it using a ".NET Installer Class Action" predefined custom action. Also, you can take a look on "How to: Host a WCF Service in a Managed Windows Service" article which should be useful for you.

Friday, January 24, 2014


I need suggestion on below issue:


Issue: We have a SharePoint publishing site for which we are experiencing bandwidth issues on document download. We have an 8 MB Network bandwidth allocated but when the document size is large the download consumes the whole bandwidth and hence other users experience performance issue.

Solution we tried:

1)      Tried to download from out of box download page of SharePoint

Result: No change on bandwidth consumption

2)      Created WCF service hosted in IIS sharing same application pool as my SharePoint site & stream the data(not buffer) . Following is the binding on client :

    <bindings>

      <basicHttpBinding>

        <binding name="BasicHttpBinding_IService1" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="6500" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true">

          <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

          <security mode="None">

            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />

            <message clientCredentialType="UserName" algorithmSuite="Default" />

          </security>

        </binding>

      </basicHttpBinding>

    </bindings>

    <client>

      <endpoint address="http://xyz/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />

    </client>

 We want to limit the data packet size to 4MB irrespective of file size returned from service so that individual user experience will be little slow but other user will not experience performance issues
Result: No change on bandwidth consumption

I have developed a WCF Service and hosted in IIS8.0.

 
When i try to browse it from IIS it is throughing certificate error.I tried without hosting it in IIS(Means in Visual Studio) as well.But in Visual studio i am getting below error.
 

Could not find a base address that matches scheme https for the endpoint with binding MetadataExchangeHttpsBinding. Registered base address schemes are [http].

 Please see below web-config screen shot in the attachment.

Wednesday, October 10, 2012

Hi ,
 
We have requirement in our project in which we have to adhere standards of third party vendor’s WSDL format (like, schema, Default namespace, messaging and binding). We have built WCF to receive In bound message from Third party vendor and we tested this successfully by creating WCF client. When we sent WSDL to third party for them to pass inbound message to our WCF web service, they said WSDL which we sent it was not in their expected format and they will not be able to consume our WCF service. We spent almost whole day to generate WSDL as per their standards but we could not achieved it.
 
If any one of you, have come across such requirement or succeeded above requirement through other way, please share your thoughts.
 
 
SOLUTION 1:
 
Below are the steps we took to generate WCF WSDL per their requirement
 
1.       Used SVCUTIL.exe to generate proxy classes for third party WSDL
2.       Created classes(name declaration, namespace, binding, serialize and messages default) in WCF as same as proxy class
3.       Then generate WSDL file after create classes in WCF.
4.       Compare both WSDL will looks same now
 
 
Happy coding J
Hi,
 
We have created silverlight application and in that we are using WCF service. We have migrated our servers to 2008 and after deployment on this server its showing this error: "The remote server returned an error: NotFound."
 
Server Details:
Windows Server 2008
IIS 7.0
.Net Framework 4.0
 
Any help on this would be highly appreciated.
 
Thanks & Regards,
Shivi

Monday, October 1, 2012

Hi,
 
We are facing problem in transferring the file of size 25 mb from one service to another wcf service that reside on different server.
we are getting an error
"There was no endpoint listening at http://xyz that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."
And inner exception as
" The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)"
 
However we are able to transfer small files having size upto 1MB.
 
The configuration we used are as follows:
<binding name="abc" closeTimeout="00:10:00" receiveTimeout="00:10:00"
  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
 <readerQuotas maxBytesPerRead="4096" maxDepth="2147483647" maxArrayLength="2147483647"/>
 
Anyone faced the similar kind of problem, or having any idea on this problem, please provide your inputs.
 
-Arora.
 
SOLUTION 1:
 
 
When you send the large amount of data via WCF it is possible to do it via 2 options.
 
1.       Enabling MTOM: When we need to send large binary data and we need interoperability also, then for BinaryHttpBinding or WSHttpBinding we can send messageEncoding property to “Mtom”.
2.       Streaming Data Mode: When we need to transfer large amount of data, streaming transfer mode is a feasible option. This can be achieved by setting transferMode property to “Streamed”/ “StreamedResponse”/”StreamedRequest” based on the requirement.
 
Please see following links for reference.
 
 
 
 
Thanks & Regards,
Maninder
 
 
 
 

Tuesday, August 14, 2012

We have created WCF service and deployed in environment. When one of our test client try to invoke method from WCF service, client is getting below error. Did anyone experienced this error in their application?  I have briefed about this. The HierarchylegacyFetch is get XML string as input parameter and method will do some append on this parameter and send back appended XML trying as output parameter. Even below I am not sending XML string, though I pass normal string value as input parameter, WCF Service thrown this error. I suspect that even before get into method, WCF throwing this error. Can anyone help on this?


Error in WCF Client Request

Friday, July 20, 2012

Hi All,
 
Our project has requirement of receiving XML file from WCF Service. Per project requirement we have to build WCF client application which should able receive XML file from WCF Server and manipulate it in WCF Client.
 
If any of you come across such requirement, please share your experience. Please help to achieve this.
 
Eagerly waiting  for your response !!!
 
Thanks,
Balaj