嗨,我对使用 WCF(半天)非常陌生,我创建了一个可以通过 localhost 看到的服务
http://localhost:[端口]/Service1.svc?- 没有 404!
但是,在我想通过应用程序连接到此服务之前,我想查看该服务是否确实返回了预期的内容。(只需确保数据库连接正常等)
我的 IService 上有这个(不幸的是它在 VB.Net 中,但我知道 C#..)
<OperationContract>
<WebGet(UriTemplate:="/method/{parameter}")>
Function getData(ByVal parameter As Integer) As String
这当然会触发(或应该) service1.svc 类中的 getData 方法。
所以启动网络服务,我试图做到这一点......
和
然而什么都没有。(也不调试代码)
环顾四周,这可能与我没有接触过的网络配置文件有关。
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="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>
<serviceHostingEnvironment 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>
我错过了什么?
谢谢