开发者

WCF service. Where to add . svc file

开发者 https://www.devze.com 2023-01-12 20:28 出处:网络
I have created a new \"WCF service library\" type project. I have created a file for my contract and one file which implements the interface. Both files have the .cs extension.

I have created a new "WCF service library" type project. I have created a file for my contract and one file which implements the interface. Both files have the .cs extension.

Please can anyone tell me how can I consu开发者_如何学运维me it. I mean where should I add my .svc file


You have to create another project - Web application or WCF Service application (generally it is the same as Web application with some added references). Then you have to reference your service library in the new project and add .svc file. Delete code behind file from newly created .svc file and open markup of that file. Modify Service attribute of @ServiceHost directive. The attribute has to point to your service implemented in library (full name with namespace). Then add configuration to web config.

If you use WCF 4.0 you don't have to create configuration (default will be used) and you even don't need to define .svc file. WCF 4.0 supports configuration based activation.

0

精彩评论

暂无评论...
验证码 换一张
取 消