首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

WCF服务报错解决方案

2013-12-23 
WCF服务报错[解决办法]你在VS中直接浏览svc能访问不一定 客户端就能调用你先保证端口是通,再确保元数据能

WCF服务报错

                                                                            
[解决办法]
你在VS中直接浏览svc能访问不一定 客户端就能调用
你先保证端口是通,再确保元数据能正确下载,如果不能下载元数据,客户端是生成不了代理类的,

你服务发布后 http://localhost:1678/Interface/UserInterface.svc改过没

把你client端config里的

bindingConfiguration="BasicHttpBinding_IUserInterface"这个发来瞧瞧看你的Binding是怎么配的,
通常我们做wcf开发的时候,会用svcutil.exe这工具来为我们生成代理类和config!
[解决办法]
你的服务端貌似没有设置端口号啊

看看下面这个配置
<span style="font-family:Times New Roman;font-size:18px;"><?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="DiaryServ.SettingServBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                    <serviceThrottling maxConcurrentCalls="10000" maxConcurrentInstances="10000" maxConcurrentSessions="10000"/>
                    <dataContractSerializer maxItemsInObjectGraph="1048576000" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
      
        <bindings>
          <wsHttpBinding>
            <binding name="BindingCD" receiveTimeout="00:10:00" closeTimeout="00:05:00" openTimeout="00:05:00" sendTimeout="00:05:00"
                     maxBufferPoolSize="1048576000" maxReceivedMessageSize="1048576000" >
              <readerQuotas maxDepth="640" maxStringContentLength="1048576000" maxArrayLength="1048576000" maxBytesPerRead="1048576000" maxNameTableCharCount="1048576000"/>


              <security mode="None">
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
      
        <services>
            <service behaviorConfiguration="DiaryServ.SettingServBehavior" name="DiaryServ.SettingServ">
                <endpoint address="" binding="wsHttpBinding" contract="DiaryServ.ISettingServ" bindingConfiguration="BindingCD">
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://127.0.0.1:9650" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>
</span>

热点排行