我正在使用Visual Studio进行一个学校项目,我将创建一个简单的WCF服务应用程序Web服务,我需要使用WCF测试客户端进行测试。
我开发了这个服务,但是当我运行调试器时,它打开了一个Web浏览器,我复制了指向IService1.svc
文件的链接,并尝试将其添加到测试客户端,但它失败了,并抱怨无法获得 meta数据。
我在一个新项目的新解决方案中尝试了这个方法,同样的事情。
我的Web.config文件:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.8.1" />
<httpRuntime targetFramework="4.8.1"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
我是否遗漏了测试Web服务的任何步骤?
1条答案
按热度按时间nszi6y051#
根据wcf配置文件的不同,您可以看到没有终结点和服务协定的部分。您可能错过了以下<service.model>部分: