2011-05-23 10 views
5

विफल रहता है मेरे पास एक कंटेनर/मास्टर सिल्वरलाइट एप्लिकेशन है। यह कंटेनर गतिशील रूप से एक्सप डाउनलोड करता है और डाउनलोड किए गए एक्सप के भीतर विशिष्ट उपयोगकर्ता-नियंत्रणों को कॉल करता है। इनमें से कुछ उपयोगकर्ता-नियंत्रण सर्वर पर होस्ट की गई डब्ल्यूसीएफ सेवा पर कॉल करते हैं।एक गतिशील रूप से लोड-एक्सप के भीतर डब्ल्यूसीएफ सेवा कॉल

निम्न त्रुटि पैदा होती है जब डाउनलोड XAP के भीतर उपयोगकर्ता नियंत्रण WCF सेवा के लिए बाहर कॉल:

System.InvalidOperationException was unhandled by user code 
Message=Cannot find 'ServiceReferences.ClientConfig' in the .xap application 
package. This file is used to configure client proxies for web services, and 
allows the application to locate the services it needs. Either include this 
file in the application package, or modify your code to use a client proxy 
constructor that specifies the service address and binding explicitly. Please 
see inner exception for details. 
StackTrace: 
    at System.ServiceModel.Configuration.ServiceModelSectionGroup. 
     GetSectionGroup() 
    at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Current() 
    at System.ServiceModel.Description.ConfigLoader.LookupChannel(
     String configurationName, String contractName, Boolean wildcard) 
    at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(
     ServiceEndpoint serviceEndpoint, String configurationName) 
    at System.ServiceModel.ChannelFactory.ApplyConfiguration(
     String configurationName) 
    at System.ServiceModel.ChannelFactory.InitializeEndpoint(
     String configurationName, EndpointAddress address) 
    at System.ServiceModel.ChannelFactory`1..ctor(
     String endpointConfigurationName, EndpointAddress remoteAddress) 
    at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory() 
    at System.ServiceModel.EndpointTrait`1.CreateChannelFactory() 
    at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(
     EndpointTrait`1 endpointTrait) 
    at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef() 
    at System.ServiceModel.ClientBase`1..ctor() 
    at LoadableSilverlightApplication.MyServiceReference.MyServiceClient..ctor() 
    at LoadableSilverlightApplication.Views.MyLoadablePage.textBlock2_Loaded(
     Object sender, RoutedEventArgs e) 
    at MS.Internal.CoreInvokeHandler.InvokeEventHandler(
     Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) 
    at MS.Internal.JoltHelper.FireEvent(
     IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, 
     Int32 actualArgsTypeIndex, String eventName) 
    InnerException: System.Xml.XmlException 
     Message=Cannot find file 'ServiceReferences.ClientConfig' in the 
      application xap package. 
     LineNumber=0 
     LinePosition=0 
     StackTrace: 
      at System.Xml.XmlXapResolver.GetEntity(
       Uri absoluteUri, String role, Type ofObjectToReturn) 
      at System.Xml.XmlReaderSettings.CreateReader(
       String inputUri, XmlParserContext inputContext) 
      at System.Xml.XmlReader.Create(
       String inputUri, XmlReaderSettings settings, 
       XmlParserContext inputContext) 
      at System.ServiceModel.Configuration.ServiceModelSectionGroup. 
       GetSectionGroup() 
     InnerException: 
      ... 

अपवाद मुझसे कहता है कि किसी भी तरह ServiceReferences.ClientConfig दिखाई नहीं देता है ... भले ही यह अंदर पैक किया जाता है डाउनलोड किया गया एक्सएपी।

मैंने पोस्ट देखे जो सुझाव देते हैं कि ServiceReferences.ClientConfig कंटेनर xap के साथ पैक किया जाना चाहिए और यह दृष्टिकोण काम करता है। हालांकि मुझे विश्वास नहीं है कि यह एक साफ समाधान है।

दूसरा विकल्प को http://weblogs.asp.net/manishdalal/archive/2009/02/23/silverlight-servicereferences-clientconfig-alternatives.aspx में सुझाए गए अनुसार स्वचालित करना है।

क्या इस समस्या का बेहतर समाधान है?

उत्तर

1

डब्ल्यूसीएफ केवल मुख्य एप्लिकेशन एक्सएपी के लिए क्लाइंटकॉन्फिग फ़ाइल में दिखाई देगा, डाउनलोड किए गए किसी भी अतिरिक्त एक्सएपी में नहीं। इसलिए आपको या तो मुख्य एक्सएपी में कॉन्फ़िगरेशन डालना होगा या कॉन्फ़िगरेशन स्वयं को आपूर्ति करना होगा, जो आपके द्वारा लिंक किया गया ब्लॉग पोस्ट करने का एक तरीका दिखाता है।

+0

सबसे पहले धन्यवाद .. आप अन्य तरीकों से क्या सुझाव देते हैं, क्या एमईएफ का उपयोग करने का कोई तरीका है –