2010-11-19 141 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