我很久以前就遇到过这个问题,而且无法回想起如何解决这个问题或者修改它的新事物。我创建了一个WCF服务,稍后我将在Web应用程序中使用该服务从远程位置调用WCF服务。现在我正在尝试在IIS中托管甚至尝试过WCFTestClient。我尝试浏览服务时遇到的错误;如下:
The type MyService.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.
我认为它可能是我的web.config文件,但我看不出什么错误:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="webHttpBinding" crossDomainScriptAccessEnabled="false" />
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webHttpBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="webHttpBehavior" name="WcfInstanceRules2.Service1">
<endpoint address=""
binding="webHttpBinding"
contract="WcfRules2.IServiceS" behaviorConfiguration="web"/>
<endpoint address="mex"
binding="webHttpBinding" contract="IMetadataExchange"></endpoint>
</service>
</services>
我希望这最终成为以json格式提供数据的休息服务。
答案 0 :(得分:0)
检查你的.svc文件并查看它引用的服务 - 可能是MyService.Service1,它在你的配置中不存在。它看起来应该引用WcfInstanceRules2.Service1。