WinFrm宿主
问题1:
使用wcftestclient 测试 发生错误, 错误信息如下:
Failedto add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
WCF元数据错误
The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address.
<system.serviceModel> <!--<diagnostics performanceCounters="All" />--> <services> <service behaviorConfiguration="HeatingManagerService" name="Hailin.HeatingManager.AppServer.Service.HeatingManagerService"> <endpoint address="service" binding="netTcpBinding" contract="Hailin.HeatingManager.AppServer.Service.IHeatingManagerService" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <!--<add baseAddress="net.tcp://localhost:8000" />--> <add baseAddress="http://127.0.0.1:8000/"></add> <add baseAddress="net.tcp://127.0.0.1:8000/"></add> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="HeatingManagerService"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="True"/> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType=""/> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> <bindings> <netTcpBinding> <binding name="service"> <readerQuotas maxNameTableCharCount="1638400" /> <security mode="None"> <transport clientCredentialType="None" protectionLevel="None" /> </security> </binding> </netTcpBinding> </bindings> </system.serviceModel>
web.config中WCF配置有问题
使用 wcftestclient 测试时,用的也是netTcpBinding吗?
@dudu: 是的。
现在报:
HTTP could not register URL http://+:8000/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
这里是不是因为没有权限啊。
你最好去微软的网站上下载一个完整的WCF例子程序下来,然后编译运行。