【发布时间】:2012-11-21 15:33:20
【问题描述】:
我选择了一个几个月未接触过的项目,我使用该项目来学习 WCF,当我在 Visual Studio 中运行它时,它会打开一个页面,让我可以获取生成的 WSDL,我可以点击服务的代码。
但是当我查看 Web.config 时,那里几乎没有任何信息:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
没有服务端点或任何东西,但它运行良好(至少在 Visual Studio 中),这是如何工作的?
【问题讨论】:
-
您可以在代码中或通过配置文件配置 WCF。您是否在代码中完全配置了您的服务?
-
不,没有任何配置,只是一个包含 3 个方法的 .svc 文件。
-
在这种情况下@vcsjones 是正确的,您正在使用 WCF 的默认值运行。
-
如果我将 web.config 替换为我配置的另一个 web.config,我怎么知道它正在被拾取而不是默认设置?
标签: .net visual-studio-2010 wcf