2011-10-09 60 views
2

我创建使用Visual Web Developer速成2010年。我想尝试各种绑定教育目的WCF服务设置为basicHttpBinding的WCF服务。在Visual Web快讯2010年

从2008年我的记忆是,在web.config自动包含在<services>一节,然后我可以编辑修改端点绑定,例如basicHttpBinding的

但是我的自动生成的2010服务不包括<services>以及<system.serviceModel>下的任何子端点或绑定详细信息(请参阅下面的web.config)。我是否需要手动将此元素添加到Web.config中,或者是否有其他方法可以配置?或者这是Express版的限制吗?

<?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="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

更新1 - 我发现下面的链接,这似乎说明了同样的行为 - 现在调查:http://forums.silverlight.net/t/166429.aspx/1

回答

3

Visual Studio的版本在这里并不重要 - 它是引起你的困惑的.NET框架的版本。在.NET 4.0中有默认的WCF设置,这意味着服务可以在没有任何配置的情况下托管。

MSDN Introduction to WCF 4会解释更多。

如果您创建项目作为.NET 3.5项目的配置将被要求(当你“添加新的WCF服务”将被添加)。

可以在.NET 4.0中添加配置,但是如果你是WCF的新手,它会更容易,如果它是自动生成的,所以你有一个起点。

+0

所以大概我需要继续,并添加绑定到webconfig,以启用不同的配置,例如 <结合messageEncoding = “MTOM”/><! - 通知没有name属性 - > Durathor

+0

是 - 如果你想改变一个绑定无需配置的服务,您需要添加一个'binding'标签,并且还需要一个'service'标签,将该绑定链接到您的服务。 –

2

看来,WCF 4创建如果没有定义一个默认的终点。从http://msdn.microsoft.com/en-us/library/ee354381.aspx

在努力使整个WCF体验就像ASMX一样容易, WCF 4配备了一个新的“默认配置”模式,彻底消除 任何WCF配置的需要。如果你不提供特定服务的任何 WCF配置,WCF 4运行时 自动与一些标准的端点和 默认绑定/行为的配置配置您的服务。这使得它更容易获得 WCF服务启动和运行,特别是对那些谁不 熟悉各种WCF的配置选项,并高兴地 接受默认值,至少上手。