wcf

WCF DataService indent xml response

别来无恙 提交于 2020-01-25 10:35:25
问题 How can i indent the xml response from my data service? All my request to the wcf data service are in xml wihout indent. I am using OData3 WCF Data Service 5.0 . Before in Odata WCF Dataservice 4, all my response data was in indent xml. 回答1: It seems that since wcf dataservice 4.0 was update in WCF Data Services 5.0 with OData 3.0, all the xml response is not intent, i solved this by implement the IDispatchMessageInspector interface and modify the current content by xdocument and

A registration already exists for URI - How to programmatically check / remove registration?

二次信任 提交于 2020-01-25 10:06:27
问题 I am hosting my WCF services in service fabric. One of the WCF service starts a HttpSelfHostServer on a port after startup. I sometimes gets the error: A registration already exists for URI 'http://localhost:10503/'. at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.CommunicationObject.EndOpen(IAsyncResult result) at System.Web.Http.SelfHost.HttpSelfHostServer.OpenListenerComplete(IAsyncResult result) In service fabric, I think there could be

CPU usage goes upto 75% while stream a 300 MB file using WCF service

允我心安 提交于 2020-01-25 10:00:22
问题 I have a wcf service that is used to download files. Its working alright (finally), but i can see that when it downloads the CPU usage goes around 75%. Please advise Client Code FileTransferServiceClient obj = new FileTransferServiceClient(); Byte[] buffer = new Byte[16 * 1024]; CoverScanZipRequest req = new CoverScanZipRequest( new string[] { "1", "2" }); CoverScanZipResponse res = new CoverScanZipResponse(); res = obj.CoverScanZip(req); int byteRead = res.CoverScanZipResult.Read(buffer, 0,

Client timeout when using WCF through Spring.net

守給你的承諾、 提交于 2020-01-25 09:22:05
问题 I'm using WCF through Spring.net WCF integration link text This works relatively fine, however it seems that WCF and Spring get in each other's way when instantiating client channels. This means that only a single client channel is created for a service and therefore the clients get a timeout after the configured timeout is expired since the same client channel has been open since it was instantiated by Spring. To make the matters worst, once a channel goes to a fault state, it affect all

C# An object reference is required for the non-static field, method, or property 'HttpContext.Request'

瘦欲@ 提交于 2020-01-25 08:00:11
问题 I am trying create a common factory class to call WCF and to inject some headers. In this class I am trying to read the HTTP Header properties. using System.ServiceModel; using System.ServiceModel.Channels; using ServiceReference; using Microsoft.AspNetCore.Http; namespace Service { public class ServiceFactory { public static ServiceClient Create() { ServiceProxy service = new ServiceProxy(); string userName = HttpContext.Request.Headers["AUTH_USERNAME"]; string authenricationType =

WCF Service Hosted in Windows Service over net tcp

橙三吉。 提交于 2020-01-25 07:23:04
问题 In my project I have one WCF Service which is hosted in a Windows Service. I hosted the WCF Service in Windows Service over netTCPBinding and Installed Windows Service. To access WCF service in my silverlight project I have added service reference of wcf. But, when I am calling a method in WCF Service am getting the following error : Could not connect to net.tcp://localhost:8732/WCFHost/. The connection attempt lasted for a time span of 00:00:03.2951885. TCP error code 10013: An attempt was

WCF - Transport Authentication - Get Credentials of Authenticated User

大城市里の小女人 提交于 2020-01-25 06:21:26
问题 I have a NetTcpBinding with SecurityMode.TransportWithMessageCredential . Transport.ClientCredentialType is set to MessageCredentialType.Windows , but I'm considering MessageCredentialType.UserName . Then there's a class DataStoreServerProxy for fetching database data which implements IDataStoreContract. It contains methods such as this one: Private Function Common_IDataStoreContract_ModifyData(ByVal ParamArray dmlStatements As ModificationStatement()) As ModificationResult Implements

WCF - Transport Authentication - Get Credentials of Authenticated User

陌路散爱 提交于 2020-01-25 06:21:20
问题 I have a NetTcpBinding with SecurityMode.TransportWithMessageCredential . Transport.ClientCredentialType is set to MessageCredentialType.Windows , but I'm considering MessageCredentialType.UserName . Then there's a class DataStoreServerProxy for fetching database data which implements IDataStoreContract. It contains methods such as this one: Private Function Common_IDataStoreContract_ModifyData(ByVal ParamArray dmlStatements As ModificationStatement()) As ModificationResult Implements

In a WCF proxy-generated client, what determines the serializer used?

筅森魡賤 提交于 2020-01-25 05:20:29
问题 When I expose a WCF service using DataContact/DataMember attributes, each service reference I make in other projects to this service generates classes with DataContract/DataMember attributes (as well as IExtensibleDataObject interface implementation, etc.). In another project, I have to use a SOAP service whose WSDL has not been generated by WCF, but by some other tool I don't know and can't change the behavior. My problem is that the code generated by my svcutil proxy is a little bit less

WCF service Unable to establish trust relationship for the SSL/TLS secure channel with authority

怎甘沉沦 提交于 2020-01-25 03:11:07
问题 I have a WCF service that I want to use to connect to an external provider's API. The Client constructor in my service looks like this: public partial class SomePortTypeClient : System.ServiceModel.ClientBase<SomeService.ClientPortType>, SomeService.SomePortType { static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); public SomePortTypeClient(string endpointUrl, TimeSpan