wcf

WCF在同步和异步调用情况下的异常捕获

若如初见. 提交于 2020-01-27 08:01:01
WCF在同步和异常调用情况下的异常捕获 1 前言 关于WCF的基本信息,我就不在这里介绍了。一来是因为园子中的很多人都介绍过了,而且很是详细,再不行,还可以看书。二来是因为自己的概念表达还不是很好,别误导了大家。 在这里,我就直接讲解一种用法,然后贴点代码吧。 在WCF有一种契约,叫做错误契约FaultContract。 今天我就讲解一下,在同步和异步调用WCF服务的时候,客户端如何捕获服务端抛出来的异常。捕获之后,如何处理,那就是根据项目的要求了。是提示呢?还是记录日志呢?还是其他什么的。。。。。。。。。。。。 2 正文 其他对于同步和异步来说,WCF处理异常的手段是一致的。都是将异常信息,通过我们自定义的一个异常信息类,传输到客户端。客户端获取到这个类的信息,然后就知道了具体的异常。然后如何处理,就是客户端的事情了。 2.1 服务定义 错误契约定义 [DataContract] public class CallException { public CallException() { } public CallException(string message, string detail) { Message = message; Detail = detail; } [DataMember] public string Message { get; set; }

Windows Communication Foundation

江枫思渺然 提交于 2020-01-26 05:57:19
Windows Communication Foundation Windows Communication Foundation (WCF) is Microsoft’s unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments. In This Section Guide to the Documentation A set of suggested topics to read, depending on your familiarity (novice to well-acquainted) and requirements. Conceptual Overview The larger concepts behind WCF. Getting Started Tutorial A set of walkthrough topics that introduces you to the experience

Unable to install service using sc command

心不动则不痛 提交于 2020-01-26 03:33:49
问题 I have my service under this folder path C:\Users\Documents\Visual Studio 2012\TestServices\TestServices\InboundMessage.ServiceHost\bin\Debug --- > here is were all my dlls and .exe is I use this command to install to my local box sc create "Receiver Services" binPath= "C:\Users\Documents\Visual Studio 2012\TestServices\TestServices\InboundMessage.ServiceHost\InboundMessage.ServiceHost.exe" displayname= "*Receiver Services" sc description "Receiver Services" "Receiver Services." sc delete

WCF contract know the domain

↘锁芯ラ 提交于 2020-01-25 21:58:31
问题 I have four projects: 1. Business project that defines the business login of my project. 2. Service contract project that defines a contract interface and DTOs. 3. Service implementation project that defines an implementation to the service. 4. Web application with svc file that uses the service. Theoretically: A. The contract project should reference to no one. B. The service implementation should reference the contract project and the domain. C. The web application should reference only the

ConcurrencyMode.Multiple in stateless WCF services

强颜欢笑 提交于 2020-01-25 21:54:11
问题 We currently have multiple WCF services which are using the default ServiceBehavior . Due to issues with scalability, we are looking at applying the ConcurrencyMode = ConcurrencyMode.Multiple attribute to improve throughput. All of our service calls are completely stateless, for example: PersonService.cs: public class PersonService : IPersonService { public GetPersonResponse GetPerson(GetPersonRequest request) { GetPersonResponse response = new GetPersonResponse(); try { response.Person =

C# User Impersonation not being passed on to sub-processes

可紊 提交于 2020-01-25 21:15:39
问题 I am trying to impersonate user for all the processes running from a console app. I don't want to start my VisualStudio as that user nor want to keep attaching external process running under that user. This is what I have tried... static void Main(string[] args) { Console.WriteLine("Environment.UserName: {0}", Environment.UserName); // Prints currently logged-in win username ConfigurationManager.GetSection("configuration"); using (var impersonator = new Impersonator()) { Console.WriteLine(

Silverlight - WCF get clientaccesspolicy on localhost

Deadly 提交于 2020-01-25 13:13:46
问题 I have a Silverlight application which uses WCF for its communications with the server. Both Silverlight and WCF are running on the local machine (localhost). When the Silverlight makes a call to the service it fails with aa communication exception. I understand that this is because I don't have a clientaccesspolicy file, but since the WCF endpoint is running on http://localhost:port I defined an interface, IPolicyRetriver, and added an implementation to the service which is returning the

WCF Metadata publishing for this service is currently disabled

限于喜欢 提交于 2020-01-25 12:28:15
问题 I am struggling to display metadata while using WCF. I have looked all over the place. I'm not sure if it is a setting in my web.config file, or my actual service is not working properly. But I get the "Metadata publishing for this service is currently disabled." page when I debug. <?xml version="1.0"?> <configuration> <system.serviceModel> <bindings> <webHttpBinding> <binding name="myWebHttp"/> </webHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="EDSCoastmap">

WCF Metadata publishing for this service is currently disabled

ε祈祈猫儿з 提交于 2020-01-25 12:28:11
问题 I am struggling to display metadata while using WCF. I have looked all over the place. I'm not sure if it is a setting in my web.config file, or my actual service is not working properly. But I get the "Metadata publishing for this service is currently disabled." page when I debug. <?xml version="1.0"?> <configuration> <system.serviceModel> <bindings> <webHttpBinding> <binding name="myWebHttp"/> </webHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="EDSCoastmap">

Weighing Cross Domain Javascript Options

倾然丶 夕夏残阳落幕 提交于 2020-01-25 11:35:26
问题 I've got some intranet scripting I am trying to go cross domain with. I'm using jQuery 1.7 and trying to weigh my options. There are 3 options I know of. JSONP Setting Access-Control-Allow-Origin on the webserver header Writing a proxy page With JSONP I am limited to GET requests. I have some large data that I would like to post and it isn't feasible with URL length limits. Setting Access-Control-Allow-Origin on the server helps for any preflight requests jQuery might do before executing. But