免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開(kāi)通VIP
silverlight調(diào)用wcf報(bào)錯(cuò)“給定關(guān)鍵字不在數(shù)據(jù)字典中”
一、             KeyNotFoundException,給定關(guān)鍵字不在字典中
         可通過(guò)使用啟用silvlerlight功能的WCF服務(wù)。當(dāng)然,普通的WCF也是可以使用在SL中的,只不過(guò)在配置上比較繁瑣。
二、             無(wú)法序列化
1.         第一類錯(cuò)誤:無(wú)法從未標(biāo)記有 DataContractAttribute 或 SerializableAttribute 的類型繼承類型……
         這類錯(cuò)誤可以通過(guò)加上如上提示的屬性解決,但更多時(shí)候需要檢查是否調(diào)用的是“啟用silvlerlight功能的WCF服務(wù)”。
 
2.         第二類錯(cuò)誤:嘗試對(duì)參數(shù) http://tempuri.org/ 進(jìn)行序列化時(shí)出錯(cuò)。
         同第一類。也有可能是代碼缺少必要的屬性。
 
3.         第三類錯(cuò)誤:格式化程序嘗試對(duì)消息反序列化時(shí)引發(fā)異常: 嘗試對(duì)參數(shù) http://tempuri.org/ 進(jìn)行反序列化時(shí)出錯(cuò)。
         同第一類。也可從修改reference.cs中的屬性的namespace解決。
 
4.         第四類錯(cuò)誤:“Element”命名空間“***”中的“***”并非所需元素。所需元素應(yīng)為“__identity”
同第一類。
 
PS: 參數(shù)類或者返回值類不能包含任何方法和構(gòu)造函數(shù)。不然也會(huì)出現(xiàn)不能序列化。     
三、             MarshalByRefObject
如果調(diào)用的是普通的WCF,則極有可能在reference.cs產(chǎn)生的客戶端代碼中,有System.MarshalByRefObject。這應(yīng)該是微軟WCF的一個(gè)BUG。因?yàn)镾L中根本就沒(méi)有這個(gè)類。查看WEBSERVICE,客戶端代碼中自動(dòng)生成了MarshalByRefObject。那么參照WS,我們也可以生成一個(gè)供WCF使用的MarshalByRefObject。如下:
 view plaincopy to clipboardprint?
[System.Runtime.Serialization.KnownTypeAttribute(typeof(DbParameter))]  
    [System.Runtime.Serialization.KnownTypeAttribute(typeof(SqlParameter))]  
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]  
    [System.Runtime.Serialization.DataContractAttribute(Name = "MarshalByRefObject", Namespace = "    public abstract partial class MarshalByRefObject : object, System.ComponentModel.INotifyPropertyChanged  
    {  
 
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;  
 
        protected void RaisePropertyChanged(string propertyName)  
        {  
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;  
            if ((propertyChanged != null))  
            {  
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));  
            }  
        }  
    } 
[System.Runtime.Serialization.KnownTypeAttribute(typeof(DbParameter))]
    [System.Runtime.Serialization.KnownTypeAttribute(typeof(SqlParameter))]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name = "MarshalByRefObject", Namespace = "
    public abstract partial class MarshalByRefObject : object, System.ComponentModel.INotifyPropertyChanged
    {
六、             典型配置ServiceReferences.ClientConfig
<configuration>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="CustomBinding_IYiPinPropWCF">
          <binaryMessageEncoding />
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
            <extendedProtectionPolicy policyEnforcement="Never" />
          </httpTransport>
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8894/YiPinPropWCF.svc" binding="customBinding"
        bindingConfiguration="CustomBinding_IYiPinPropWCF" contract="ServiceReferenceYiPinProp.IYiPinPropWCF"
        name="CustomBinding_IYiPinPropWCF" />
    </client>
  </system.serviceModel>
</configuration>
 
6:典型配置Web.config
<system.serviceModel>
  <behaviors>
   <serviceBehaviors>
    <behavior name="YiPin.QuestionsDbSL.Web.YiPinPropWCFBehavior">
     <serviceMetadata httpGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <bindings>
   <customBinding>
    <binding name="customBinding0">
     <binaryMessageEncoding />
     <httpTransport/>
    </binding>
   </customBinding>
  </bindings>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  <services>
   <service behaviorConfiguration="YiPin.QuestionsDbSL.Web.YiPinPropWCFBehavior"
    name="YiPin.QuestionsDbSL.Web.YiPinPropWCF">
    <endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
     contract="YiPin.QuestionsDbSL.Web.IYiPinPropWCF" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
  </services>
 </system.serviceModel>
 
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Winform客戶端引用WCF客戶端后,部分類無(wú)法正常使用
C# 使用MarshalByRefObject跨程序調(diào)用方法
.net 真實(shí)代理和透明代理的交互
System.MarshallByRefObject.cs
【重要】VB.NET中的多行字符串
Silverlight Wcf 獲取集合數(shù)據(jù)并綁定
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服