2012-05-20 60 views
0

我是WCF新手为什么WCF端点地址每次都会改变?

为什么每次运行这个服务时,它都运行在不同的地址上,而不是在我写的地址中运行?

我很抱歉,如果这是很容易:(

<configuration> 
    <system.serviceModel> 
    <services> 
    <service behaviorConfiguration="PBServiceBehavior" name="PhoneBookService.PbService"> 
     <endpoint name="PbHttpEndpoint" 
      address="http://localhost:9001/PhonebookService" 
      binding="basicHttpBinding" 
      contract="PhoneBookService.IPbService" /> 
    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior name="PBServiceBehavior"> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <serviceMetadata httpGetEnabled="true" /> 
     </behavior> 
    </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="false" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

enter image description here

回答

0

如果您的WCF服务是由IIS或托管内置的Web服务器(卡西尼)在Visual Studio中,您配置被使用。

相反,您在IIS(其中*.svc文件存在)中定义的虚拟目录,或叔他在Visual Studio中动态定义(并可能更改)由内置Cassini Web服务器使用的地址将确定您的端点地址。

0

也许你得检查一下这个设置 enter image description here

相关问题