WCF 和 ASP.Net 预编译
在我的 asp.net Web 应用程序的“服务”目录中拥有 WCF 服务。 。
/Services/MyService.svc
/Services/MyService.svc.cs
将我的源代码复制到虚拟目录时一切正常 由于各种原因,我们真的希望预编译代码,但是当我们这样做时,服务中断了。我假设因为现在“.cs”文件已预编译,并且“/Services”目录中不再有“MyService.svc.cs”。
错误
我的 .svc 标记是标准的:
<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.MyService" CodeBehind="MyNamespace.MyService.svc.cs" %>
我是否做错了什么,或者我可以在 WCF 客户端/服务上进行更改以允许 ASP.net 预编译?
Have a WCF service in a "Services" directory in my asp.net web app. In
/Services/MyService.svc
/Services/MyService.svc.cs
Everything works when copying my source code to the virtual directory. We were really hoping to precompile the code for various reasons, but when we do the service breaks. I am assuming becuase now the ".cs" file is precompiled and there no longer is a "MyService.svc.cs" in the "/Services" directory.
The Error
Error: Cannot obtain Metadata from http://myurl.com/services/MyService.svc
My .svc mark up is the standard:
<%@ ServiceHost Language="C#" Debug="true" Service="MyNamespace.MyService" CodeBehind="MyNamespace.MyService.svc.cs" %>
Is there something I am doin wrong, or that I can change on the WCF client/service to allow for ASP.net precomilation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您正在谈论预编译站点,请查看 此博文。基本上该网站必须是可更新的。
Assuming you're talking about a precompiled site, take a look at this blog post. Basically the site has to be updatable.
我的一位同事发现了这个并且它有效。这不是最好的解决方案,但它确实有效。
http://social. msdn.microsoft.com/forums/en-US/wcf/thread/8c897f8e-2143-450e-a9f4-97d1f8702da7/
编辑:
更好的解决方案...我们使用部署项目,似乎该项目指定除非另有说明,否则将项目名称作为虚拟目录路径。我们打开部署项目文件并将以下节点更新为适当的虚拟目录名称:
One of my coworkers found this and it works. It is not the best solution, but it works.
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/8c897f8e-2143-450e-a9f4-97d1f8702da7/
EDIT:
Even better solution...We use a deployment project and it seems that the project specifies the project name as the virtual directory path unless otherwise specified. We opened up our deployment project file and updated the below node to the appropriate virtual directory name: