我有一个WCF服务,该服务正在Windows服务中托管。 Windows主机服务具有一个使用服务端点的App.config,该服务具有一个公开元数据端点的App.config。当通过VS开发系统部署服务时,一切工作正常。加载Web浏览器后,http://localhost:9001/ URL解析为元数据网页,其中公开了该服务的wsdl链接。它甚至还可以与WCF测试客户端一起使用,并且我可以发送服务消息并做出响应。
但是,将projectInstaller加载到VS中的托管服务上并部署到VS开发系统之外时,将托管服务部署在Windows中后,我将无法再访问http://localhost:9001/元数据终结点。服务已启动并正在运行,但是端点没有响应。使用“ sc create binpath =“ Service.exe” start = auto”命令从调试文件夹中部署服务。也许这不是部署它的正确方法,不确定或我的app.Config文件不正确或未正确引用。有人可以让我知道此过程,并可以验证我的app.Config文件对于Windows Host和Service端均正确。配置起来非常棘手,因此不胜感激。
窗口宿主服务App.config使用端点:
<system.serviceModel>
<client>
</client>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_WindowsService" maxReceivedMessageSize="20000000" />
</basicHttpBinding>
</bindings>
<services>
<!-- Service endpoint to consume -->
<service name="WindowsService.Service">
<endpoint address="http://localhost:9001/Service" binding="basicHttpBinding"
contract="WindowsService.IService" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
通过Web.config服务公开端点:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_WindowsService" />
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="defaultbehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="defaultbehavior" name="WindowsService.Service">
<!-- Base address for exposing Metadata and Service -->
<host>
<baseAddresses>
<add baseAddress="http://localhost:9001/" />
</baseAddresses>
</host>
<!-- Metadata service endpoint to expose -->
<endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
<!-- Service contract endpoint to expose -->
<endpoint address="Service" binding="basicHttpBinding" contract="WindowsService.IService" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>