默认的wcf服务应用程序没有定义端点

Tho*_*mas 6 c# wcf

我刚刚在VS2010(Premium)中创建了一个新的WCF服务应用程序项目,它开箱即用,但是当我打开web.config文件时,没有端点存在.应用程序工作正常,我可以在浏览器中打开地址(http:// localhost:50639/Service1.svc?wsdl),我可以看到合同,这一切看起来都很好.

所以我的问题是,如果默认项目使用了不同的方法,而不是将信息放在web.config中?我也看不到代码中的任何内容.

为了表明我的观点,这就是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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>
Run Code Online (Sandbox Code Playgroud)

仍然这项服务工作,我可以连接和调用默认方法(例如GetData())

Lad*_*nka 8

这不是一种"不同"的方法.这是WCF 4.0中一种称为简化配置的新方法.如果您在.NET 4.0中创建项目,您将获得此简化模式.如果您在.NET 3.5中创建项目,您将获得旧的聊天配置.