返回首页

知识点

将net.tcp协议寄宿到IIS

https://www.cnblogs.com/Gyoung/archive/2012/12/11/2812555.html
https://www.cnblogs.com/zxj159/p/3927556.html

问题

未能从程序集“System.ServiceModel”中加载类型“System.ServiceModel.Activation.HttpModule”

IIS服务器中部署WCF服务程序时,通过浏览器访问报出该问题
原因:这是因为先安装了 .NET Framework 4,随后启用了 .NET Framework 3.5 WCF HTTP 激活,则会发生此错误
只需要已管理员用户在cmd中运行aspnet_regiis.exe -i即可。
C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/aspnet_regiis.exe -i

知识点

创建宿主为IIS的WCF 可以创建WCF服务应用程序


知识点

服务端config配置样例

<system.serviceModel> <bindings> <netTcpBinding> <binding name="MyTcpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" sendTimeout="00:30:00" transferMode="Streamed"> <security mode="None"> </security> </binding> </netTcpBinding> </bindings> <services> <service name="WCFUploadService.FileService"> <endpoint address="" binding="netTcpBinding" bindingConfiguration="MyTcpBinding" contract="WCFUploadService.IFileService"> <!--<identity> <dns value="localhost" /> </identity>--> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:9005/FileService.svc" /> <add baseAddress="net.tcp://localhost:808/FileService.svc" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior> <!-- 为避免泄漏元数据信息, 请在部署前将以下值设置为 false --> <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" /> <!-- 要接收故障异常详细信息以进行调试, 请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息--> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>

知识点

客户端config配置样例

<system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBinding_IFileService" transferMode="Streamed"> <security mode="None" /> </binding> </netTcpBinding> </bindings> <client> <endpoint address="net.tcp://x6x8-20120929lc/FileService.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IFileService" contract="FileService.IFileService" name="NetTcpBinding_IFileService"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> </system.serviceModel>

知识点

WCF 实现上传/下载 服务端有IIS和WPF两种

代码链接

WCF 服务端元数据关闭 客户端能否使用

WCF 服务端如果关闭了源数据交换终结点,但没有关闭业务终结点,新的客户端则无法连接,因为获取不到源数据(除去http的),已经连接过的客户端可以正常使用。