在没有 Web 项目的情况下向我的 svc 文件添加信息?
我在这里遵循本指南:
现在已经到了在它的末尾我需要添加:
<%@ ServiceHost Language="C#" Debug="true" Service="Wcf.ComboService" Factory="Wcf.DIServiceHostFactory" %>
到我的 svcfile, 问题是我没有 svcfile,根据这篇文章,您必须添加来自 Web 应用程序的引用才能获取它: 添加缺少的 .svc 文件
真的没有办法做到这一点吗?或者也许让这个代码在没有 svc 文件的情况下工作?
I'm following this guide here:
And has now come to the end of it where i need to add :
<%@ ServiceHost Language="C#" Debug="true" Service="Wcf.ComboService" Factory="Wcf.DIServiceHostFactory" %>
to my svcfile,
the problem is that i dont have an svcfile and according to this post you must add a reference from a Web-application to get it:
Adding .svc file missing
Is there really no way to do this? or maybe make this code work without the svc-file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.svc 文件只是一个具有不同扩展名的文本文件,因此无论您使用哪种 Visual Studio 解决方案,您始终可以将其添加为文本文件。
它没有被编译,而是与 WCF 二进制文件一起放置,指示 IIS 如何创建服务实例。如果配置正确,IIS 会解释 .svc 文件并从二进制文件启动服务。
但是,如果您不想在 IIS 中托管服务,则不需要 .svc 文件。您可以仅使用 ServiceHostFactory 手动启动服务:
这称为自托管。
An .svc file is just a text file with a different extension, so you can always add it as a text file, no matter what sort of Visual Studio solution you use.
It's not compiled, but rather sits alongside the WCF binaries, instructing IIS on how to create service instances. If configured correctly, IIS interprets the .svc file and spins up the service from the binaries.
However, if you don't want to host your service in IIS, you don't need an .svc file. You can just use the ServiceHostFactory to manually spin up the service:
This is called self-hosting.