2010-11-19 61 views
6

我刚刚在VS2010(Premium)中创建了一个新的WCF服务应用程序项目,它可以直接使用,但是当我打开web.config文件时,没有终点出现。该应用程序工作正常,我可以在浏览器中打开地址(http:// localhost:50639/Service1.svc?wsdl),我可以看到合同,它看起来都很好。默认wcf服务应用程序没有定义端点

所以我的问题是,如果默认项目已使用不同的方法,而不是将信息放在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> 

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

回答

8

这不是一个“不同”的方法。这是WCF 4.0中一种名为simplified configuration的新方法。如果你在.NET 4.0中创建项目,你会得到这个简化模式。如果你在.NET 3.5中创建项目,你会得到旧的健谈配置。

+0

这对于HTTPS是否正确?我找不到任何参考。 – Spock 2015-03-10 23:03:50

+0

对不起,只是自己试了一下。是的,它也适用于HTTPs :) – Spock 2015-03-10 23:17:23

+0

@Spock你是如何得到这个支持HTTPS的? – Arj 2016-02-11 11:31:51