wcf服务中ServiceHost指令中的服务类型问题 [英] Problem with type of service in ServiceHost directive in wcf service

查看:248
本文介绍了wcf服务中ServiceHost指令中的服务类型问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的wcf服务进行测试.当我使用本地IIS 7.5测试此服务时,它便可以正常工作.但是,当我将其托管在Web IIS中时,会收到此错误:

I am developing a simple wcf service for test. When I test this service with my local IIS 7.5, then it works properly. But when I host it in web IIS, I receive this error:

类型'WcfServiceLibrary1.Service1', 作为服务属性提供 ServiceHost指令中的值,或 在配置元素中提供 system.serviceModel/serviceHostingEnvironment/serviceActivations 找不到.

The type 'WcfServiceLibrary1.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

我的ServiceHost是:

And my ServiceHost is:

<%@ ServiceHost Language="C#" Debug="true" Service="WcfServiceLibrary1.Service1" %>

请帮助我解决此问题

推荐答案

因为在我为此寻找的任何问题中都找不到我建议的问题,所以在这里添加我的案例:

Because I couldn't find this suggested in any of the questions I looked through for this, adding my case here:

当我手动更改文件MyService.svc.cs中的名称空间,并且没有更改相应文件MyService.svc中的服务名称时,我遇到了这个问题-原来它需要为Service ="namespace.classname .

I had this problem when I manually changed the namespace in the file MyService.svc.cs, and did not change the Service name in the corresponding file MyService.svc - turned out that it needed to be Service="namespace.classname".

这篇关于wcf服务中ServiceHost指令中的服务类型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆