wcf

C# WCF Service Reference - can not create UserNameToken

本小妞迷上赌 提交于 2021-02-20 04:34:25
问题 In my desktop application (C#, WPF, WCF, .NET4.0) I addes a service reference. This is Web Service (SOAP) using certificate and UserNameToken in Soap Envelope Header. I add service reference (Solution -> Service Reference -> Add Service Reference) using WSDL of this web service. In my app.config I have got: <customBinding> <binding name="tmsIntegrationServiceSOAP"> <!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:CDM/tmsIntegrationService/': --> <!--

Convert Soap XML to a Json Object in C#

我的梦境 提交于 2021-02-19 08:39:31
问题 Background Information I have two .net services (say A and B). Service B uses a service reference of Service A. Here, 'basicHttpBinding' is being used. There is a global.asax.cs present in Service A where I plan to perform some operations before the call is sent to Service A.svc.cs I'm able to read request body in global.asax.cs using the following code. StreamReader streamReader = new StreamReader(HttpContext.Current.Request.InputStream); streamReader.BaseStream.Position = 0; string message

Can't pass in “%26” to a WebGet UriTemplate variable in a WCF service?

亡梦爱人 提交于 2021-02-19 04:19:41
问题 I have a WCF service with this declared operation: [WebGet(UriTemplate = "Test/{*testString}")] public String Test(String testString) { return testString; } However when attempting to invoke the URL Test/You%26Me , IIS returns an error: A potentially dangerous Request.Path value was detected from the client (&). My goal is to allow an ampersand in the URI via its URL-Encoding: %26 The wildcard did not help. Is there any way to prevent this error without disabling security features? 回答1: Try

Can't pass in “%26” to a WebGet UriTemplate variable in a WCF service?

房东的猫 提交于 2021-02-19 04:19:06
问题 I have a WCF service with this declared operation: [WebGet(UriTemplate = "Test/{*testString}")] public String Test(String testString) { return testString; } However when attempting to invoke the URL Test/You%26Me , IIS returns an error: A potentially dangerous Request.Path value was detected from the client (&). My goal is to allow an ampersand in the URI via its URL-Encoding: %26 The wildcard did not help. Is there any way to prevent this error without disabling security features? 回答1: Try

Autofac ASP.NET Web API (Beta) Integration

╄→гoц情女王★ 提交于 2021-02-19 01:57:36
With the beta release of ASP.NET MVC 4 and the ASP.NET Web API being released a few weeks ago, I decided it was about time to have a look at what the integration story would like for Autofac. The package is available for download on NuGet. Install-Package Autofac.WebApi2 -Version 4.2 . 0 While building the preview of the Web API integration I had the following goals in mind: Ensure that it would work alongside the MVC integration without issues such as naming conflicts. Support both the web hosting and self hosting scenarios in a single assembly. Avoid taking dependencies on the System.Web

WCF Enum By Value Surrogates to support dynamic enums

巧了我就是萌 提交于 2021-02-19 01:37:54
问题 I'm trying to make WCF Support unnamed enums. I've created a Surrogate which works fine when its an enum. However when it's a nullable enum it fails on deserialization. This is my surrogate which was modified from this article, my code differs since I don't want to supply known types: public class EnumValueDataContractSurrogate : IDataContractSurrogate { #region Interface Implementation public Type GetDataContractType(Type type) { return type; } public object GetObjectToSerialize(object obj,

WCF client passing username token with mustUnderstand set to true

半世苍凉 提交于 2021-02-18 22:24:27
问题 I'm tasked with creating a WCF service that will be consumed by an external client. The client is using WSSE security, specifically, they're passing a username token via a SOAP header. The WCF service is hosted on an IIS server with SSL enabled. At this point, I have a semi-working prototype. The issue I'm dealing with now is that the SOAP header has the mustUnderstand attribute set to 1, and this causes the process to fail. I'd like some advice (or better yet, a code example smiles ) on how

503 error consuming thirdy part Soap webservice using TLS 1.2 and client certificate authentication with WCF

百般思念 提交于 2021-02-18 19:40:40
问题 I've got a problem consuming a Soap Web Service(w/att.) and MTOM that requires client certificate authentication (mutual?). Before writing what i've already tried i show you what i did in order to receive a client certificate: I've generated a RSA key with openssl command openssl genrssa -out mykey.key 2048 With this key i've generated a CSR : openssl req -new -key mykey.key -out mycsr.csr I've sent this CSR to the web service owner in order to receive a client certificate , and they gave me

503 error consuming thirdy part Soap webservice using TLS 1.2 and client certificate authentication with WCF

廉价感情. 提交于 2021-02-18 19:38:57
问题 I've got a problem consuming a Soap Web Service(w/att.) and MTOM that requires client certificate authentication (mutual?). Before writing what i've already tried i show you what i did in order to receive a client certificate: I've generated a RSA key with openssl command openssl genrssa -out mykey.key 2048 With this key i've generated a CSR : openssl req -new -key mykey.key -out mycsr.csr I've sent this CSR to the web service owner in order to receive a client certificate , and they gave me

A call to SSPI failed, see inner exception when running the call a second time?

五迷三道 提交于 2021-02-18 17:10:30
问题 I have the following code : public GetUserDataResponse GetUserDataFromService(X509Certificate2 certificate) { ChannelFactory<MyApp4SITHSService.IMyApp4SITHSServiceContract> factory = new ChannelFactory<MyApp4SITHSService.IMyApp4SITHSServiceContract>("NetTcpBinding_IMyApp4SITHSServiceContract_Certificate"); MyApp4SITHSService.IMyApp4SITHSServiceContract service; GetUserDataResponse response; factory.Credentials.ClientCertificate.Certificate = certificate; //factory.Credentials.UserName