zoukankan      html  css  js  c++  java
  • WCF 的学习过程

      之前没有接触过WCF,这两天学习中。把遇到的问题和解决办法记下来。

    遇到的问题:

    (1).HTTP 错误 404.17 - Not Found

    请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理

    (2).HTTP 错误 500.21 - Internal Server Error

    处理程序“svc-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    (3).“/”应用程序中的服务器错误。


    在主机(“IntegratedWindowsAuthentication”)上配置的身份验证方案不允许在绑定“BasicHttpBinding”(“Anonymous”)上配置的方案。请确保 SecurityMode 设置为 Transport 或 TransportCredentialOnly。此外,还可以通过以下方式解决此问题: 通过 IIS 管理工具更改此应用程序的身份验证方案,通过应用程序配置文件中 <serviceAuthenticationManager> 元素处的 ServiceHost.Authentication.AuthenticationSchemes 属性更改身份验证方案,通过更新绑定上的 ClientCredentialType 属性或通过调整 HttpTransportBindingElement 上的 AuthenticationScheme 属性。

    (5).在使用WCF 的过程中遇到:

    已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。

    1.做个小入门的程序(博客园的文章,不废话,直接动手那个,好像那个服务的方法是ShowName()),以下是开发过程。

    2.解决办法:

    以管理员身份运行CMD,输入如下命令即可。其中命令最后的“modules”为页面中显示错误红色字段的节点名称。 

    然后是:(刚安装的系统,没有开启IIS 服务)没有注册好IIS 中aspnet的这个东西,注册下。

    之后:是权限问题,把对应的权限修改,指定某个用户。

    最后:成功显示WCF服务

     第5个问题的解答方案:

    1.

    在WCFTestClient里能看到一个ConfigFile,---》右键---在SvcConfigEditor里编辑,然后找到绑定的设置就可以了。

    这个不能直接在WCFTestClient设置,双击打开的文件默认是只读的。这里也将MaxReceivedMessageSize等值设置为:2147483647。在Help工具栏,设置无须总是重新加载配置文件。

     2.在web.config中配置,添加红色部分代码,或者设置其值为:

    <wsHttpBinding>
    <binding name="MaxMessage" closeTimeout="00:01:00" openTimeout="00:01:00"
    receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647"
    maxReceivedMessageSize="2147483647">
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    <security mode="Message">
    <transport clientCredentialType="Windows" />
    </security>
    </binding>
    <!--v-shunhu:set WSHttpBinding_INewsScrapingService maxReceiveMessageSize-->
    <binding name="WSHttpBinding_INewsScrapingService"
    maxReceivedMessageSize="2147483647"
    maxBufferPoolSize="2147483647">
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
    </wsHttpBinding>
    ---------------分割线---------------
    <serviceBehaviors>
    <behavior name="NewsScrapingServiceBehavior">
    <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
    <serviceThrottling maxConcurrentCalls="200" maxConcurrentInstances="200" maxConcurrentSessions="200" />
    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
    <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
    <serviceDebug includeExceptionDetailInFaults="true"/>
    <!--v-shunhu:modify value '9000000' to '2147483647'-->
    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
    </serviceBehaviors>

  • 相关阅读:
    python函数的基本语法<三>
    python函数的基本语法<二>
    python中文件的基础操作
    python模块——configparser
    python模块——psutil
    python中程序的异常处理
    python——协程
    hbuilder 开发app 自动升级
    C# datagridview 这是滚动条位置
    C# 小知识点记录
  • 原文地址:https://www.cnblogs.com/shy-huang/p/4082252.html
Copyright © 2011-2022 走看看