WCF 提示未能调用服务
在WcfTestClient中测试WCF时遇到下列提示:未能调用服务。可能的原因: 服务已脱机或无法访问;客户端配置与代理不匹配;现有的代理无效。有关详细信息,请参阅堆栈跟踪。可以尝试通过启动新的代理、还原到默认配置或刷新服务来恢复。
以下是我的Web.Config文件:
--------------------编程问答-------------------- 将你WCF所在的web项目发布到IIS中去,然后去掉端口号:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<!--添加服务-->
<service name="MyServices.UserService" behaviorConfiguration="UserServiceBehavior">
<endpoint address="http://localhost:8000/UserService" binding="wsHttpBinding" contract="MyServices.IUserService"></endpoint>
</service>
<service name="MyServices.ArticleService" behaviorConfiguration="ArticleServiceBehavior">
<endpoint address="http://localhost:8000/ArticleService" binding="wsHttpBinding" contract="MyServices.IArticleService"></endpoint>
</service>
</services>
<!--定义CalculatorServiceBehavior的行为-->
<behaviors>
<serviceBehaviors>
<behavior name="UserServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8000/UserService"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="ArticleServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8000/ArticleService/mex/"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<!--添加服务-->
<service name="MyServices.UserService" behaviorConfiguration="UserServiceBehavior">
<endpoint address="../UserService" binding="wsHttpBinding" contract="MyServices.IUserService"></endpoint>
</service>
<service name="MyServices.ArticleService" behaviorConfiguration="ArticleServiceBehavior">
<endpoint address="../ArticleService" binding="wsHttpBinding" contract="MyServices.IArticleService"></endpoint>
</service>
</services>
<!--定义CalculatorServiceBehavior的行为-->
<behaviors>
<serviceBehaviors>
<behavior name="UserServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="../UserService"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior name="ArticleServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="../ArticleService/mex/"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
补充:.NET技术 , Web Services