wcf-endpoint

WCF DataService over Https

☆樱花仙子☆ 提交于 2019-12-08 03:08:00
问题 I am developing a WCF DataService that's self-hosted inside a Windows Console Application. I want to activate my service over Https (i.e. SSL) instead of Http. How can I do that? Thanks 回答1: First Creating a CA Certificate on Windows (use Visual Studio Command Prompt): makecert -sv SignRoot.pvk -cy authority -r signroot.cer -a sha1 -n "CN=Dev Certification Authority" -ss my -sr localmachine Now put the certificate in the "Trusted Root Certification Authority" in Windows Key Store. That can be

WCF: Why is Contract on Endpoint and not on Service?

…衆ロ難τιáo~ 提交于 2019-12-07 23:58:20
问题 Trying to really 'get' endpoint contracts: I understand offering different endpoints to support different bindings, but when would one define n endpoints for a service, and use different contracts? Seems that in most cases (bar IMetadataExchange) the endpoint contract would be the same no matter the protocol, no? If most of the time the contract would be the same across all endpoints, would it have been too simplistic (and why?) to define the service contract on the parent service instead of

WCF endpointBehaviors extension not picked up when the name param is present?

旧时模样 提交于 2019-12-07 09:38:12
问题 I am trying to extend my service endpoint behaviour with custom MessageInspector, extension works fine and its picked up, but only if I don’t define the “name” parameter on behaviour tag and don’t define specific behaviorConfiguration on the endpoint. This means I am extending all endpoints and this is what I don’t want. Could anyone please explain me what am I doing wrong? This config doesn't pick up myBehaviour extension and doesn't fail. <system.serviceModel> <services> <service name=

Possible to have same contract, same binding, same address, but different ports?

拟墨画扇 提交于 2019-12-07 07:32:52
问题 I have handhelds that need to communicate via basicHTTPBinding. I have a contract and everything works as advertised. I need to expand it to easily support changing to a test environment, training and of course production. I took the port route, thinking I could expose different endpoints with port differences, and based on the port, decide which database I wanted info from. I cant seem to make this work, and so far have found no information anywhere that indicates it can be done. Since port

WCF DataService over Https

蹲街弑〆低调 提交于 2019-12-06 10:33:46
I am developing a WCF DataService that's self-hosted inside a Windows Console Application. I want to activate my service over Https (i.e. SSL) instead of Http. How can I do that? Thanks First Creating a CA Certificate on Windows (use Visual Studio Command Prompt): makecert -sv SignRoot.pvk -cy authority -r signroot.cer -a sha1 -n "CN=Dev Certification Authority" -ss my -sr localmachine Now put the certificate in the "Trusted Root Certification Authority" in Windows Key Store. That can be done through MMC. To do that: Run... -> Type "mmc" -> enter -> choose the "Certificates" console -> Find

How to add maxItemsInObjectGraph programmatically without using configuration file?

好久不见. 提交于 2019-12-05 17:13:52
问题 I have create a EndpointAddress like that EndpointAddress address = new EndpointAddress("http://example.com/services/OrderService.svc"); But I could not add the Behavior to this Endpoint programmatically. The behavior is given below.: <behaviors> <endpointBehaviors> <behavior name="NewBehavior"> <dataContractSerializer maxItemsInObjectGraph="6553600" /> </behavior> </endpointBehaviors> </behaviors> 回答1: On the server you have to add it in the ServiceBehavior Attribute: [ServiceBehavior

WCF endpointBehaviors extension not picked up when the name param is present?

蹲街弑〆低调 提交于 2019-12-05 17:13:12
I am trying to extend my service endpoint behaviour with custom MessageInspector, extension works fine and its picked up, but only if I don’t define the “name” parameter on behaviour tag and don’t define specific behaviorConfiguration on the endpoint. This means I am extending all endpoints and this is what I don’t want. Could anyone please explain me what am I doing wrong? This config doesn't pick up myBehaviour extension and doesn't fail. <system.serviceModel> <services> <service name="testService"> <endpoint address="http://localhost:9999/TestServiceService" binding="wsHttpBinding" contract

Determine which wcf endpoint is being used on the server

社会主义新天地 提交于 2019-12-05 12:19:43
问题 I have a wcf service thats exposing a service using two endpoints. One endpoint is used for web service calls while the other is using rest. Is there a way to determine from which endpoint the server functions are being called? 回答1: Actually, contrary to what I thought - it's actually pretty easy to find out what endpoint the service was called on. In your service method, add these lines of code: OperationContext oc = OperationContext.Current; if(oc != null) { string wasCalledOn = oc

Possible to have same contract, same binding, same address, but different ports?

送分小仙女□ 提交于 2019-12-05 08:38:25
I have handhelds that need to communicate via basicHTTPBinding. I have a contract and everything works as advertised. I need to expand it to easily support changing to a test environment, training and of course production. I took the port route, thinking I could expose different endpoints with port differences, and based on the port, decide which database I wanted info from. I cant seem to make this work, and so far have found no information anywhere that indicates it can be done. Since port is optional, it may not be. Anyone done anything like this? Although you can't do what you want with

WCF - let the client choose the return format

心已入冬 提交于 2019-12-04 05:04:39
I'm trying to learn some WCF on my own. I have C#/ASP.net knowledge but I am new to WCF. I am using Visual Studio 2010 to develop some apps while I learn. I developed a small web service which acts as the backend for a TODO/Task manager where a user can create/delete/edit new events; it's all very simple and basic. My questions are the following: Is there a way to let the client choose the return format he wants (e.g. xml/json/rdf) without writing new operation contracts? How can I see on the client the exact message the Web Service sends to me (so that I can check if it's for instance a json