WCF服务基地地址http和netTcp

编程入门 行业动态 更新时间:2024-10-27 01:21:01
本文介绍了WCF服务基地地址http和netTcp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有我的WCF服务配置文件定义了两个基地地址:

I have two base addresses defined in my WCF Service config file:

<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true"> <listeners> <add type="System.Diagnostics.DefaultTraceListener" name="Default"> <filter type="" /> </add> <add name="ServiceModelTraceListener"> <filter type="" /> </add> </listeners> </source> </sources> <sharedListeners> <add initializeData="C:\WCF Service Logs\app_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="DateTime, Timestamp"> <filter type="" /> </add> </sharedListeners> </system.diagnostics> <system.serviceModel> <bindings> <netTcpBinding> <binding name="netTcp" maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000"> <readerQuotas maxDepth="500" maxStringContentLength="50000000" maxArrayLength="50000000" maxBytesPerRead="50000000" maxNameTableCharCount="50000000" /> <security mode="None"></security> </binding> </netTcpBinding> </bindings> <services> <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior" name="ReportingComponentLibrary.TemplateReportService"> <endpoint address="TemplateService" binding="netTcpBinding" bindingConfiguration="netTcp" contract="ReportingComponentLibrary.ITemplateService"></endpoint> <endpoint address="ReportService" binding="netTcpBinding" bindingConfiguration="netTcp" contract="ReportingComponentLibrary.IReportService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:8001/TemplateReportService" /> <add baseAddress="localhost:8181/TemplateReportService" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ReportingComponentLibrary.TemplateServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>

虽然我已经设置终点为NetTcpBinding的结合, 我只能够与基址访问我的WCF服务:

And although I have set endpoint binding as netTcpBinding, I am only able to access my WCF service with base address:

localhost:8181/TemplateReportService

而不是

net.tcp://localhost:8001/TemplateReportService

我如何可以与netTcp我的业务接入解决?

How can I make my service access with netTcp address?

推荐答案

您定义的基础的net.tcp地址是:

You defined a Net.TCP base address to be:

net.tcp://localhost:8001/TemplateReportService

您的端点与网络的TCP是:

Your endpoints with Net TCP are:

<endpoint address="TemplateService"

<endpoint address="ReportService"

所以他们的完整的服务地址将是netTcp基地址+相对作为定义地址&LT;端点&GT; 元素 - 这给:

net.tcp://localhost:8001/TemplateReportService/TemplateService

net.tcp://localhost:8001/TemplateReportService/ReportService

尊敬。

您可以用它们在这些地址??

Can you use them at these addresses??

另外 - 你所定义的MEX(元数据交换)端点HTTP协议 - 这就是为什么你可以看到的东西,当你浏览到HTTP地址。但是你没有指定一个MEX端点netTcp。

Also - you defined a "mex" (metadata exchange) endpoint for the HTTP protocol - that's why you can see something when you navigate to the HTTP address. But you did not specify a MEX endpoint for netTcp.

更多推荐

WCF服务基地地址http和netTcp

本文发布于:2023-11-07 09:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566052.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地址   基地   WCF   http   netTcp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!