gpt4 book ai didi

c# - 在网站内添加 WCF 服务以进行发布

转载 作者:太空宇宙 更新时间:2023-11-03 12:06:18 24 4
gpt4 key购买 nike

我有一个托管在 IIS 上的网站,用户可以在 Internet 上从外部访问它。现在我也想对我的网络服务使用相同的域名,并允许用户在互联网上访问它,所以我只是在我的网站内添加了该服务的已发布代码文件夹,这样 URl 将如下所示。

网站:http://mytestsite.com/home

WCF 服务:http://mytestsite.com/services/testservice.svc

但是当我尝试使用 testservice.svc 时出现错误提示

The service '/mytestsite/services/testservice.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'AWL.AI.WWIP.SBLPayService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..

AWL.AI.WWIP 是服务和合约的命名空间。该服务本身是一个独立的解决方案,名称为 AWL.AI.WWIP。现在我试图将该文件夹添加到我的网站中,但它抛出了这个错误。即使我重命名文件夹以匹配命名空间名称,它也不起作用。它抛出同样的错误。非常感谢任何帮助。

最佳答案

感谢所有的输入,我能够找到解决方案。正如我在问题中提到的,我在我的网站文件夹中添加了服务文件夹。并将服务文件夹转换为应用程序。在 IIS 中,您有此选项,右键单击该文件夹,您可以选择转换为应用程序。我这样做了,它在我的网站名称下创建了一个节点,然后你就可以访问服务而无需任何更改并使用网站域。所以我现在可以说,

http://mytestsite.com/services/testservice.svc

在浏览器中和宾果游戏!你看到了服务。无需更改 web.config。

关于c# - 在网站内添加 WCF 服务以进行发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54769774/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com