WCF

Windows Communication Foundation (WCF) is a tool used to implement and deploy a service-oriented architecture (SOA) to support distributed computing where services have remote consumers. It features a runtime and a set of APIs in the .NET Framework for building connected, service-oriented applications. Services typically have a WSDL interface (Web Services Description Language) that any WCF client can use to consume the service, regardless of which platform the service is hosted on. WCF implements many advanced Web services (WS) standards such as WS-Addressing, WS-ReliableMessaging, WS-Security, RSS Syndication Services, WS-Discovery, routing and better support for REST services.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have a C# WCF application that I've been working on. It contains 2 sites, an external one and an internal one.

Previously they have both worked perfectly. I have local urls for each app defined in IIS pointing to 2 different AppPools. I am using a defined user and have given this user Full Control for the entire directory structure of the app's code as well as Permissions on each of the apps and set the identity for each AppPool. When I click on the Test Settings button, they both show green checks next to the Authentication and Authorization.

I recently had to delete my local repo and Clone the one from our TFS server. The external one no longer runs saying that Access is Denied. The internal app works perfectly.

Any ideas on what I can check to help figure out why this is happening?
0
Exploring SQL Server 2016: Fundamentals
LVL 19
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

WCF Timeout in web.config file.

closeTimeout="00:30:00" openTimeout="00:30:00"

This is 30 seconds or 30 minutes?
0
I need to create a custom error class in C# for a WCF service where  in i need to send a list of string values back to the client. How do i create the error class??
0
I have a couple of WCF services to host inside IIS.
Here is a snapshot of web.config
 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
      <serviceActivations>
        <add service="ECMS.Business.Managers.SecretaryManager" relativeAddress="~/SecretaryService.svc" factory="ECMS.WebHost.CustomHostFactory" />
        <add service="ECMS.Business.Managers.SettingManager" relativeAddress="~/SettingService.svc" factory="ECMS.WebHost.CustomHostFactory" />
        <add service="SwaggerWcf.SwaggerWcfEndpoint" relativeAddress="~/Swagger.svc" factory="ECMS.WebHost.CustomHostFactory" />
      </serviceActivations>
    </serviceHostingEnvironment>

Open in new window


    <services>   
      <service name="ECMS.Business.Managers.SecretaryManager">
        <endpoint address="" behaviorConfiguration="WebHostFactoryService" binding="webHttpBinding" contract="ECMS.Business.Contracts.ISecretaryService" />
      </service>

         <service name="ECMS.Business.Managers.SettingManager">
        <endpoint address="" behaviorConfiguration="WebHostFactoryService" binding="webHttpBinding" contract="ECMS.Business.Contracts.IEcmsSetting" />
      </service>
      
      <service name="SwaggerWcf.SwaggerWcfEndpoint">
        <endpoint address="" behaviorConfiguration="WebHostFactoryService" binding="webHttpBinding" contract="SwaggerWcf.ISwaggerWcfEndpoint" />
      </service>

    </services>

Open in new window


I deployed into IIS and when I request http://localhost/SecretaryService.svc

I got 404 not found exception.

Requested URL         http://localhost:80/SecretaryService.svc
Physical Path         D:\Electronic Clinic Management System (eCMS)\eCMS\ECMS.WebHost\SecretaryService.svc

Please help,
0
I have a remote machine runs a managed windows service which exposed a WCF on a specific port.

<endpoint address="net.tcp://127.0.0.1:8001/SecretaryService" binding="netTcpBinding" contract="ECMS.Business.Contracts.ISecretaryService" bindingConfiguration="EcmsNetTcpBinding" />

Open in new window


I made sure that the service is listening on the port locally by using "portqueryui.exe" utility from Microsoft.

I used the same utility to test the connection to the remote machine, port. It gives that unknown service is NOT LISTENING.

The remote machine is pingable!
I added firewall rules for the port. I turned off the windows defender with no luck.

Please help,
0
I am developing an electronic medical record (EMR) system.

I am designing and implementing the backend APIs using WCF.

Now, I have two system actors: secretary and doctor.

I designed the services according to the actor he/she is concerned.

[ServiceContract]
public interface ISecretaryService
{
}

[ServiceContract]
public interface IDoctorService : ISecretaryService
{
//the doctor has the functions of secretary in case she was absent!
}

Open in new window


The problem is I have duplicate code which is the implementation of the ISecretary contract in doctor service.
0
Hi,

I have a question. I have a existing WCF type framework that has like 8 difference .svc's and in each one of those .svc's there are like 40 different web services (methods) that are called.  This is in ASP.NET and C#.

I am going to start implementing REST aspects as well with ASP.NET and C#.

Is it wise to maintain 2 separate frameworks? One for REST methods (could also be 10-20 different methods) and that over existing SOAP svc's? Or do I combine the REST calls/process into the existing WCF?

If the suggestion is 2 separate frameworks... does anybody have an example of how that would be done in REST?

Any information would be greatly appreciated.

Thanks!
0
Hi,
I am developing on-premise Electronic Medical Records (EMR) app for a clinic.
I architected the solution using Domain Driven Design approach combined with the following architectural styles:
  • Layered architectural style: for structuring the solution and separation of concerns
  • 3-Tier architectural style: for deployment
     
  1. Database tier: Sql Server database
;
      [list=2]Application server tier[/list];
      [list=3]Presentation tier as a desktop app[/list].
  • SOA architectural style: for the communication between the desktop app and the application server; Where the application server exposes the business services.

I have the following error on the application server when I tried to access the WCF security service from the web browser:

"The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."

Attached the solution source code.
eCMS---Anas.zip
0
I am having trouble while sending the request to a rest service. The service works fine on my desktop, but getting the following error when i host on the IIS.

The remote server returned an error: (400) Bad Request.

After some analysis i noticed that the error i am getting is with the POST. All Get methods are working fine. I am trying to send a JSON string to create a record.

Here is my source code:

ServiceContract

namespace WcfRestService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IOrderService" in both code and config file together.
    [ServiceContract]
    public interface IOrderService
    {
        [OperationContract]
        [WebInvoke(UriTemplate = "/PlaceOrder",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        bool PlaceOrder(OrderContract order);

        [OperationContract]
        [WebGet(UriTemplate = "/GetOrderDetails/{OrderID}",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json)]
        OrderContract GetOrderDetails(string OrderID);

        [OperationContract]
        [WebGet(UriTemplate = "/GetOrderTotal/{OrderID}",
                ResponseFormat = WebMessageFormat.Json)]
        string GetOrderTotal(string OrderID);
    }
}

Open in new window


Service


namespace WcfRestService
{
    // NOTE: You can use the "Rename" 

Open in new window

0
Given this information...
POST /Sale/Application/v2/mypage.asmx HTTP/1.1
Host: b2b2.mywebsite.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Persist"

Open in new window




How would I post my xml data to a service in vb.net web page win 4.5 environment

I do NOT want to import the wsdl
0
CompTIA Network+
LVL 19
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

We have a new sharepoint online site connected to an on premise WCF service using BCS.  Our Office 365 syncs with our on premise AD server using Azure.  Access to our new sharepoint site works fine for internal users.  We have shared the site with an external user to test.  The person can login and view the site but when that user tries to access anything that uses the WCF service, it says "access denied".  When looking at metadata store permissions.  It does not allow me to add "everyone" or "all users (membership".  I can find it when browsing, but when I try to add it, it says it doesn't exist.  I can only add "everyone except external users".
0
I am attempting to resolve an issue WCF Rest Service and I am able to step through debug in one way:

I am able to step-through by calling on the URL specifying the method on the URL:

        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "/GetMember/{strTest}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string GetMember(string strTest);

Open in new window


But what I really needed is more like an object in the RequestBody. So, I originally had:

        [OperationContract]
        [WebInvoke(Method = "POST", UriTemplate = "/GetMember",  RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        GetTestMemberRes GetMember(GetTestMemberReq TestMemberReq);

Open in new window


I am getting this:
Results of test
And it does not even hit the breakpoint.

When I do the first operation contract I had to change the signature of the method. But when I do that and use the GET as well as update the URITemplate it works and I hit the break point but when I change it to a POST and use the object GetTestMemberReq. I get the above?

If the first one is working my config changes should be good.

I am using C#, .NET 4.0, and VS 2017.

Any information as to what I might be doing incorrectly.

Very much appreciated.
0
We are trying to POST to a WCF REST method. We can successfully POST using SoapUI, Postman, and YARC but when we try in Angular 5 I'm receiving a NULL object.

Client code:
    const headers: any =  {'Content-Type': 'application/json'};
    return this.ajax.request<any>({
        url: url,
        method: method (POST),
        headers: headers,
        options: {
            body: JSON.stringify(req.body)
        }
        });
    }

    public request<T>(req: AjaxRequest): Observable<HttpEvent> {
        return this.http.request<T>(req.method, req.url, req.options)
    }

    //this.http = HttpClient

    // Component
    public onNext(event: any): void {
        this._saveInfo(getInsertDmgReqPayload({
            data: event.value,
            dmgInfo: this.responses['dmg'],
            emailId: this.util.getQueryStringValue('uname')
        }));

        this.util.navigate('education');
    }

    private _saveInfo(data: any): void {
        this.appraisal.request('saveDmgInfo', null, {body: data})
        .subscribe(v => {
            console.log(v);
        });
    }

Open in new window


Server-side logic:
// WCF Interface definition
    [OperationContract]
    [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
    Result InsertDemographicInfo(Demographic d);

    // Service code
    public Result InsertDemographicInfo(Demographic d) // The Demographic object is null when posting from Angular
    {
        Result result = new Result();
        try
        {
            DemographicFactory.InsertDemographicInfo(d);
            result.Status = "Success";
        }
        catch (Exception ex)
        {
            result.Status = "Fail";
            result.Message = ex.Message;
        }
        return result;
    }

Open in new window


Web config:

Open in new window

0
I have a question regarding validation of fields provided from a WCF web service.

Let's say that the web service has 6 fields:

MemberFirstName
MemberLastName
MemberNumber
AptType
City
Referral


Now, I want to check that when a Referral is provided the MemberFirtName *and* MemberLastName are also provided. When a City is provided the AptType *or* a MemberLastName is provided.

What is the best way to achieve something like that?


This is in C# with VS 2015.

Any information would be greatly appreciated.
0
I have the codes below
1. RetrieveData is working fine., but now I want to assign class library value in a loop.
Basically, I have wcf call to get the list of name which is exactly same as class library property name - see newretrievedata
Is it possible to do that?

On another side of class library in c#, i already have all of the property/object in class library.


     
  public JsonResult RetrieveData(string ID)
        {
            Domain.Lead l = new Domain.Lead();
            l.firstname = "John";
            l.lastname = "Smith";
            return Json(l, JsonRequestBehavior.AllowGet);
        }

 
        public JsonResult newRetrieveData(string ID)
        {
            Domain.Lead l = new Domain.Lead();


            foreach (KeyValuePair<string, string> i in Helper.DynamicsCRM.GetAllLeadInfoByMetaData3("a51ec467-7255-e811-81153863bb3c4538"))
            {               
                //Response.Write(i.Key + " >> " + i.Value + "<br>"); Key has firstname, and lastname, etc.
            	l.i.Key = i.Value;
            }
            return Json(l, JsonRequestBehavior.AllowGet);
        }

Open in new window

0
In a very simple Silverlight Application I have a DomainService Class which has a single method that returns a list of Letter Objects.

The application works fine when I run it in VisualStudio. However, when I publish it to a folder on my Windows 10 local machine and run it using IIS (version 10.0.166299.5) I get the following error:
The remote server returned an error: NotFound. at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.b__17(Object )

I supect this is due to something being wrong in missing in my WebConfig file. My WebConfig Currently looks like this:

<?xml version="1.0"?>

<configuration>


    <system.web>
      <compilation debug="true" targetFramework="4.6" />
      <httpRuntime targetFramework="4.6" />
    </system.web>




  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="DomainServiceModule" preCondition="managedHandler" type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
  

Open in new window

0
Hi, I have 3 years of experience in Release Engineer and Software Engineer,

As I have less work for release management so I request for software development work to manager and got some work parallely. Now I am doing both Release as well as software development work in AngularJS, C#, WCF, MySQL, ASP.NET MVC etc. but my designation is "Release Engineer" . Now I want to switch to software engineer to different organization with this experience.

So is it possible? or how it should be done?

Please Help.

Thanks.
0
Is there any easy way to convert a WCF application to a pure web based application.
0
Hello guys,

I´m getting this error while trying to setup Outlook with autodiscover

Process w3wp.exe (FE_Autodiscover) (PID=8708). WCF request (Get Servers for sametime.cz) to the Microsoft Exchange Active Directory Topology service on server (TopologyClientTcpEndpoint (localhost)) failed. Make sure that the service is running. In addition, make sure that the network ports that are used by Microsoft Exchange Active Directory Topology service are not blocked by a firewall. The WCF call was retried 1 time(s). Error Details
 System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.

Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at …
0
Amazon Web Services
LVL 19
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Hello,

I have a webservice that I,m trying to apply a custome security, when I try to call the service it display the following error:


http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:FailedAuthentication

At least one security token in the message could not be validated.


To add the security I modify the service config file:

[b][b]<services> <service name = "WcfService1.Service1"> <endpoint address="" binding="customBinding" bindingConfiguration="customBindingOasis" contract="WcfService1.IService1"> <headers> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken> <wsse:Username>USERNAME</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password> </wsse:UsernameToken> </wsse:Security> </headers> </endpoint> </service> </services> <bindings> <customBinding> <binding name ="customBindingOasis"> <security authenticationMode="UserNameOverTransport" includeTimestamp="false" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"> <secureConversationBootstrap /> </security> <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8"> <readerQuotas maxDepth="32"
0
Hello,

I have this WCF service that works fine using soap1. I'm trying to change it to run in soap1.2 but I have not been able.

I have try changin diferents things in the webconfig.

First I change the basicHttpBinding for wsHttpBinding.  I also change the protocol , remove the soap1.1 and add the soap 1.2

How I can made that my WCF web service run in soap1.2?
0
what are advantages of creating a REST service in Web API vs some other technologies in .NET like WCF, ASP .NET MVC etc.
0
Hello.

When trying to add a service reference I receive the following error:

"The configuration for the service reference could not be added due to the following issue: An error occurred creating the configuration section handler for system.serviceModel/bindings: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) (C:\....\web.config line 154)"

But, looking in web.config I am not seeing the problem.

Thanks. :)
0
Hello,
I have written a mock for a REST service using SoapUI free version. The resource path looks like <webservice>/employees which returns all employees in JSON. Now I want to pass a parameter which is a date range, something like <webservice>/employees?from=01-01-2017&to=31-12-2017
This will return only a few employees who joined during the date range. I am not able to find a way to accept parameters in the mock response and not sure how do i check something like if(date == 01-01-2017 to 01-04-2017) { //pass this json text   } else if(date == 08/08/2017 to 31/12/2017) { pass this text }

Any help would be greatly appreciated as I am new to SoapUI
0
Hi,

We have a server 2012 R2. When we want to add 1 of the 2 features below the installation failes with error 0x800f0922

The 2 features who fail are:
.NET Framework 4.5 Features\WCF Services\Named Pipe Activation
.NET Framework 4.5 Features\WCF Services\TCP Activation

What can we do to solve this? Any help is appreciated.
0

WCF

Windows Communication Foundation (WCF) is a tool used to implement and deploy a service-oriented architecture (SOA) to support distributed computing where services have remote consumers. It features a runtime and a set of APIs in the .NET Framework for building connected, service-oriented applications. Services typically have a WSDL interface (Web Services Description Language) that any WCF client can use to consume the service, regardless of which platform the service is hosted on. WCF implements many advanced Web services (WS) standards such as WS-Addressing, WS-ReliableMessaging, WS-Security, RSS Syndication Services, WS-Discovery, routing and better support for REST services.

Top Experts In
WCF
<
Monthly
>