Go Premium for a chance to win a PS4. Enter to Win

x

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

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
Important Lessons on Recovering from Petya
LVL 11
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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
I have a C# WCF Service hosted in IIS 8.5 which has a simple Client webform consisting of a ComboBox for data entry. The ComboBox can be populated manually or via barcode scanner on the users mobile device. Every time the user uses scanned input the scanned value is written to a database table with UserId, dateTime & value. I have an API which will return the last scanned input for a user based on dateTime scanned.

So I now have a webform which can take its input either manually or via scanned input. If there is no selected value in the comboBox then I want to run a background job to call the API and return any scanned input value to the ComboBox.  

CheckForScannedTransactions below is part of the Client WebForm1 and it calls the background job StartBackgroundProcess passing parameters MyBGJobParms. I expected control to return to UI but when there is no scanned input to return control never returns to the UI despite RunWorkerAsync. Why is this ?

In this scenario every logged on user will call CheckForScannedTransactions() to check for their own scanned input. Is there a better way of doing this ? Could I for instance have just 1 background job running continuously and updating scanned input to each users webform page. Is that possible if so How so?



//CheckforSacnnedTransactions will run in background and populate any scanned value to ComboBox if ComboBox is empty 
if (ComboBox1.SelectedIndex == -1 )
{
    CheckForScannedTransactions ();
}

Open in new window



Open in new window

0
I am trying to install Sharepoint 2016 and have just been running into issue after issue. I have tried all suggested solutions available but have had no luck. Any clue why this is happning? The prerequisite installer (such a terrible and useless tool IMO) failed to install anything during the prerequisite installation process so I had to install the prerequisites manually. I tried reinstalling WCF data services 5.6 tools using the prerequisite installer in command line with the correct parameters and had no luck. I have tried reinstalling the .net 4.6.2 framework as well.

I am running a fresh install of Windows Server 2012 R2 and the database server is running Microsoft SQL Server 2014

Here is the error:

One or more configuration settings failed. Completed configuration settings will not be rolled back. resolve the problem and run this configuration wizard again. The following contains detailed information about the failure.

Failed to create the configuration database.

An exception of type Microsoft.Sharepoint.Upgrade.SPUpgradeException was thrown. Additional exception information: One or more types failed to load. Please refer to the upgrade log for more details.

I have also attached the error log. Any suggestions?
PSCDiagnostics_9_22_2017_15_31_48_91.log
0
I have a C# WCF Service which is hosted in IIS 8.5 and has a number of web services. One of these web services is called MobileRegistration and when called from the Client works correctly (see below)

using (var svc = new DCRulesServiceRef1.TransactionClient())
{string returnval = svc.MobileRegistration(enterpriseId, userId, deviceId, qrcode);}

Open in new window


However I also need to be able to call the webservice MobileRegistration directly via a URL without having to go through the client. The URL I created is as follows

http://xx.xx.xx.xxx/DCRules2Alias/Service.svc/MobileRegistration/?&userId=TESTUSER&enterpriseId=TESTENTERPRISE&deviceId=TESTDEVICE&qrcode=TESTQRCODE
This fails with HTTP400 Webpage cannot be found.

http://xx.xx.xx.xxx/DCRules2Alias/Service.svc  does return the TransactonService Service page successfully.  So why can it not find my service. Is the format of the URL incorrect for a WCF web service ? Below is some of the relevant code and WSDL. Appreciate if someone can point out what I am doing wrong

regards
Pat

Operation Contract for MobileRegistration web service
[OperationContract]
[WebGet(UriTemplate = "MobileRegistration?enterpriseId={enterpriseId}&userId={userId}&deviceId={devicerId}&qrcode={qrcode")]

        string MobileRegistration(string enterpriseId, string userId, string deviceId, string qrcode);

Open in new window


Web.config file
   <!-- Required to prevent error

Open in new window

0
Hello
I have WCF service which emails invitation for members to join a particular enterprise. The URL sent to the users is as follows:

Please respond to invitation using the Link below:
http://www.tios.ie/account/invite.aspx?enterprise=AAAAAA&enterpriseName=BBBBBB&emailaddress=CCCCCC

This would take this to the Invite Page where they could accept or reject the invitation. This all worked fine until recently. However now when the URL is clicked, instead of going to the invite page , it seems to be trying to redirect to the Login Page. Nothing is displayed but the URL displayed on the browser is as follows:  

http://www.tios.ie/Account/Login.aspx?ReturnUrl=%2faccount%2finvite.aspx%3fenterprise%3dAAAAAA%26enterpriseName%3dBBBBBB....

I am not sure why this is happening or how I would go about debugging. Appreciate some suggestions.
0
I am part of a development for a SOAP web services client on WCF/.NET. After a session of sending request, team for server side left feedback "extend someAction from schema i am mentioning below", and mentioned an URL. In this context, what does it mean to extend from schema?
0
Dears.,

Referring to some links, I could fix by changing in web config of my WCF to open WCF using https from IIS manager but in my application upon running it gives below error message when calling a method from WCF web services: The provided URI scheme ‘https’ is invalid; expected ‘http’.Parameter name: via

Any hint?
Regards

Besides , in order to let my WCF open normally, we recommend to adjust in web.config mainly in 3 parts below:
Part 1
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="Soc_MobileWebServices.MobileService">
        <endpoint address=""  
                  binding="basicHttpBinding"  
                  bindingConfiguration="secureHttpBinding"  
                  contract="Soc_MobileWebServices.IMobileservice"/>  

        <endpoint address="mex"  
                  binding="mexHttpsBinding"  
                  contract="IMetadataExchange" />  
      </service>
    </services>
Part 2
          <serviceMetadata httpsGetEnabled="true"/>

Part 3
    <bindings>
      <webHttpBinding>
        <binding name="" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </webHttpBinding>
      <basicHttpBinding>  
        <binding …
0
Hello sir , i'm using WCF services in both web application and android . Now i want to implement encryption and decryption of various id's  so if i apply the encryption and decryption then on the web end i can easily manage the code but for android developer this is very hectic problem therefore suggest me how can i manage the code.
0
[Webinar] Cloud and Mobile-First Strategy
LVL 11
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

I have a class called "globals" which holds multiple classes that are use by my WCF application. So for example globals consists of up to 50 classes. Until now I have been defining classes with globals  as follows:

   public class Commands
    {
        DataSet ds = new DataSet();
        DataTable dt1=new DataTable("dt1");
        DataSet ds2 ;//= new DataSet("ds2");
        DataTable dt2; //= new DataTable("dt2");
        DataRow dr2;
        string[] delimitedList1;
        string[] delimitedList2;
        string[] delimitedList3;
        string[] delimitedList4;
        string[] delimitedList5;

        string currentDataType = null;
        string ds1XmlString = " ";
        string ds2XmlString = " ";
        string myStringValue = "";
        int cnt = 0;
        DataSet dsCopy = null;
        DataSet dsCopy2 = null;
        DataSet cltDS = null;
        DataSet dsSav1 = null;
        DataSet dsSav2 = null;
        DataSet dsSav3 = null;
        DataTable fileSchema;
        public Commands()
        {

        }

Open in new window


      globals g;

I now realize that by placing globals into class Commands that it is part of this class rather than a reference.I want to create class Commands and be able to reference variables that are available in globals without having to imbed globals as part of class commands. Appreciate if someone can explain how I can achieve this ?

regards
Pat
0
I have a simple page (SOAP Request) I can call in  a browser or from SoapUI.org app

http://mywcfClient.com/Service.asmx?op=SendMail

I type in the two variables and it returns a success or fail string

How do I call that in a C# Web Page?
0
I have a WCF Service written in C# which makes extensive user of global variables. The Service runs menus and transaction which are made up of sequenced database records with each database record capable of calling specific logic based on inbuilt commands. A typical simplistic example could be:

  05  Start
  10  Display Screen
  20  Input Range of Items
  30  run SQL statement to retrieve item details from Item master table
  40  Display Item Details
  50  Confirm selected Items
*60  Run SQL statement to report on Item Usage
*70  Output SQL results to CSV  
*80  Email usage report to user
  90  Goto Start

Those marked with * should run in a background thread so that after seq 50 the user will be returned to seq 05 whilst the background thread takes over. The issue I have is that Many of the variables controlling the transactions are global variables and so when the user returns to 05 and then exists to a new transactions this effects the background job since the background job is running the same code as the UI , except in the background thread.

I have copied all of the variables from UI to the background thread however the UI continues to update these global background thread variables after the background thread is launched. How can I stop the UI from affecting the background thread global variables ?

Pat
0
Hi Team,

We would like to secure our API so that no body can hack the same.
We are working in .Net platform. Please provide some input to implement the same.

Reason to secure


1) Hacking
2) Data security

Please let me know
0
SRCarrierInfo.CarrierAgentActInfoServiceClient cgsClient = new SRCarrierInfo.CarrierAgentActInfoServiceClient();
cgsClient.GetCarrierWebsiteInformation(); //this is custom class library it will be returned. The name is likes: List<Domain.Carrier>


how can i expose my class library to the public? I use DNN 8 as client to call above object. and I can not reference my custom class library inside of DNN module project.
0
How can a WCF Service return a file (perhaps in stream?) based on its file type?

The idea is to let the end user calling the web method and then to get the file downloaded to end user.

Thank you.
0
Hello Expert Team,

I am trying to develop a method in WCF service to dump data in an SQL tables
I asked the user to give us a json string with a specific format
if I test it for a small json , the method works correctly
but I tried to test for a long string it gives 'HTTP Error 414. The request URL is too long.'
 <WebGet> _
    Function GetHello(UserParam As String) As String
-----------------------
    Public Function GetHello(Json_Parameter As String) As String Implements IMobileservice.GetHello
        Dim ParameterInfoLength As String = ""

        Try
            ParameterInfoLength = Json_Parameter
        Catch ex As Exception
            ParameterInfoLength = ""
        End Try
        ParameterInfoLength = "This is the result of " & ParameterInfoLength
        Return ParameterInfoLength
    End Function

Do we have a solution?
Besides, I develop same method using a web services, it gives a window unresponsive to wait/kill, after a wait time ,  I get an answer, the method displays the string
 <WebMethod()> _
    Public Function GetHello(Json_Parameter As String) As String
        Dim ParameterInfoLength As String = ""

        Try
            ParameterInfoLength = Json_Parameter
        Catch ex As Exception
            ParameterInfoLength = ""
        End Try
        ParameterInfoLength = "This is the result of " & ParameterInfoLength
        Return ParameterInfoLength
    End Function

What do you suggest?
What is the best and …
0
Hi;

My question is simple; i am gonna to call below service :

http://www.webservicex.com/globalweather.asmx?op=GetWeather

But; something is wrong, it is returning to me Data Not Found. How can i fire it? My c# code is :

  myService.GlobalWeatherSoapClient client = new myService.GlobalWeatherSoapClient();
            Console.WriteLine(client.GetWeather("Stockholm", "Sweden"));
            Console.WriteLine(client.GetWeather("Berlin", "Germany"));

Open in new window

0
Hello,
I need to update an existing WCF service to allow labels to be printed from locally attached DYMO Labelwriter 450 printers (attached by USB port to the client). In the client application I have installed the following from nuget packages.

DYMO SDK Library with default label V1.0.1
DYMO Label Framework TypeScript.Definitily.Typed V0.6.3

If I specify the code below I get a  Namespace error. I have checked the assemblies after the Nugut upload but there are no DYMO assemblies present.  What am I doing wrong. How can I get the client to recognise the DYMO Labelprinter. Appreciate any help or examples that anyone can give me.

regards
Pat
 
using DYMO;  
public void PrintLabel(string serial_num, string part_Num)
        {
            var label = DYMO.Label.Framework.Label.Open(AppDomain.CurrentDomain.BaseDirectory + "Barcode.label");
            label.SetObjectText("Bar_code", serial_num);
            label.SetObjectText("text_box", part_Num);
            label.Print("DYMO LabelWriter 450 Turbo");
        }
0
Free Tool: IP Lookup
LVL 11
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I've built the default Visual Studio 2015 C# WCF Service Application.  Runs fine with the included client using the default connection http://localhost:50127/Service1.svc

For further testing I'm using Terra Term with the same URL, with and without the service1.svc, http, :50127 etc. Always get an Invalid Host error!

When I publish to a server (with its own IP) I have the same problem

Might this be related to the 50127 port and if so how would I change that?
0
I am having problems connecting to an Oracle database from my C# WCF service. In the WCF service I am already connecting to multiple DB2 and SQL databases successfully via the following ole connection string.


mySqlStmt =  "select * from myfile"
myConnectionString =  "Provider=sqloledb; Data Source=DEV\SQLEXPRESS;Initial Catalog=MyDataBase;User Id=user123; Password=pass123"

OleDBConnection conn = new OleDBConnection(myConnectionString);
conn.Close();
OleDbCommand cmd = new OleDbCommand(mySqlStmt, conn);
conn.Open();
cmd.Connection=conn
conn.Close();  

This has worked well for me. However I now need to connect to an Oracle database with the existing software. I have been given the connection details

Data Source=TestDB
User Id= User123
Password= Pass123

I downloaded Oracle XE to our Windows 2012 server and updated the TNSNAMES.ORA file with the connection details and then created a .UDL file to test the connection to the oracle database.  By keying in the above Data Source, User name and Password to the test connection properties I got "Test connection Succeeded"  The Oracle provider listed in the test connection is "Oracle Provider for OLE DB"

I then set up a new connection string in my application as follows:

Provider=OraOLEDB.Oracle;Data Source=TestDB;User Id=User123;Password=Pass123;

However when my application tries to connect to the database via my application I get an error message "
0
I have a WCF service that can only be accessed by domain users. I used the following config:
    <system.web>
        <authentication mode="Windows" />
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>

Open in new window

The service is hosted on IIS 6, where Windows authentication is enabled and anonymous - disabled. the above worked fine for me but now i want to limit access to only a single uers. i tried the following:

    <system.web>
        <authentication mode="Windows" />
        <authorization>
            <allow users="DOMAIN\user1" />
            <deny users="*" />
        </authorization>
    </system.web>

Open in new window

but that did not work - all the domain users have access, not just user1.

I also tried:
    <authorization>
            <allow users="DOMAIN\Group1"/>
            <deny users="DOMAIN\Domain Users"/>
    </authorization>

Open in new window

I also tried to utilize PrincipalPermission attribute to limit access to a method:

 [PrincipalPermission(SecurityAction.Demand, Role = "Group1")]

Open in new window


But it did not make any difference at all. What can i do to limit the access to a user or group?
0
I have a WCF Service which I need to host on an old IIS 6 server. The server has a name Server1 but also has an alias used for the website. Apparently the server and the website resolve to different IP addresses.

So WCF Service path is

https://alias.sys.domain.com/ProjectName/MyService.svc?wsdl

Open in new window


But when I look at xml generates, the schemaLocation shows up as:

    <wsdl:types>
      <xsd:schema targetNamespace="http://tempuri.org/Imports">
         <xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0" namespace="http://tempuri.org/" /> 
         <xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/ProjectName" /> 
         <xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
       </xsd:schema>
    </wsdl:types>

Open in new window


If I try accessing the schema specified in the xml

https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0

Open in new window




I get "Page cannot be displayed" error, and if I use Network tab in Chrome debug tools, it shows the call has been aborted. But if I try accessing the schema at

https://alias.sys.domain.com/ProjectName/MyService.svc?xsd=xsd0

Open in new window



Then I can get to it without a problem but, unfortunately this is not the one used by the service.

To change that I added httpsGetURL in my config file:

<serviceMetadata httpGetEnabled="true" httpsGetUrl="https://alias.sys.domain.com/ProjectName/MyService.svc"  />

Open in new window


that caused error: "A registration already exists for URI"

which I was able to get rid of by adding "/mex" after ".svc". The strange thing is that I do not have mex endpoint since I cannot use it due to disabled anonymous authentication.

But adding "/mex" caused another error "The message with To 'https://alias.sys.domain.com/ProjectName/MyService.svc/mex?wsdl'
cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.
Check that the sender and receiver's EndpointAddresses agree."

So then I added address to my endpoint, changing it from

<endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/>

Open in new window


to

<endpoint address="web1" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/>

Open in new window


and tried using

https://alias.sys.domain.com/ProjectName/MyService.svc/web1

Open in new window


that changed my error to


Open in new window

0
I have a .NET project to which i want to add a reference to my WCF service hosted on a different server. When I open my service in IE, it works fine:

https://alias.domain.com/ProjectName/MyService.svc?wsdl

Open in new window


But when I try to create a service reference using the above url, I cannot - getting "The document was understood, but it could not be processed"

Can anyone help?
0
I ran my WCF service on the server without SSL enabled and now I moved it to one with SSL enabled and I am getting the following error:

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

Open in new window


Below are my settings:

<bindings>
      <basicHttpBinding>
        <binding name="basicHTTP">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows">
            </transport>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="basicBehavior" name="ProjectName.MyService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHTTP" contract="ProjectName.IMyService"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="basicBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

Open in new window

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
>