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