Page view counter
It's not possible to add a Service Reference for my WebService
Last post 04-29-2008 10:20 AM by TomKid. 4 replies.
Sort Posts:
04-29-2008 4:30 AM
It's not possible to add a Service Reference for my WebService

Hello,

 I have created a Silverlight Application Project with the name test for example. I have selected "Web Application Project" as Project Type.

In the second project test_web I have added a simple WebService that sum two digits. Therefore I have clícked the right mouse button in the test_web project and selected WebService.

Now, when I add a Service Reference to the Silverlight project (test) then I'll get two warnings (see below). For this I click the right mouse button in the folder Service References. After I compile the project, the application will be crash with the following error in page.xaml.cs in the constructor by InitialzieComponenet().

------
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.dll

Additional information: AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 9 Position: 56]
--------

 What is the solution? How can I use the WebService.

 Thanks for your help.

 ------------------------------------

The two warnings:

Warning 1 Custom tool warning: Removing unsupported type System.Windows.Controls.OpenFileDialog
System.TypeLoadException: Could not load type 'System.Security.SecuritySafeCriticalAttribute' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.IsCustomAttributeDefined(Module decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable)
   at System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit)
   at System.RuntimeType.IsDefined(Type attributeType, Boolean inherit)
   at Microsoft.VisualStudio.ServicesProxy.WcfSilverlightCodeGenerationExtension.WsdlImporting(WsdlImporter importer) E:\SilverlightApplicationWebSerivce\SilverlightApplicationWebSerivce\Service ReferencesService References\ServiceReference1\Reference.svcmap 1 1 SilverlightApplicationWebSerivce

Warning 2 Custom tool warning: Removing unsupported type System.Windows.Browser.HttpUtility
System.TypeLoadException: Could not load type 'System.Security.SecuritySafeCriticalAttribute' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.IsCustomAttributeDefined(Module decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable)
   at System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit)
   at System.RuntimeType.IsDefined(Type attributeType, Boolean inherit)
   at Microsoft.VisualStudio.ServicesProxy.WcfSilverlightCodeGenerationExtension.WsdlImporting(WsdlImporter importer) E:\SilverlightApplicationWebSerivce\SilverlightApplicationWebSerivce\Service References\ServiceReference1\Reference.svcmap 1 1 SilverlightApplicationWebSerivce

 

TomKid

Loading...
Joined on 04-15-2008
Karlsruhe (Germany)
Posts 12
04-29-2008 5:50 AM
Re: It's not possible to add a Service Reference for my WebService

TomKid:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.dll
 

What did you write in XAML?

TomKid:
The two warnings:
 

Alex DeJarnatt - MSFT said as below in this post,  So, well, I guess you should probably ignore those warning. :)

You can ignore those warnings, they shouldn't be getting generated at all.  I am working on getting rid of them right now, actually... Wink

Yes, there are some known issues in Beta 1 consuming amazon and other internet web services, and sharepoint web services for that matter.  Believe me, we are well aware of the issue. :)  For Beta 1 your best bet to get started is to use a WCF or asmx web service hosted in the same project that is hosting the silverlight control.  This stuff is def. better in Beta 2.

 

TomKid:

 I have created a Silverlight Application Project with the name test for example. I have selected "Web Application Project" as Project Type.

In the second project test_web I have added a simple WebService that sum two digits. Therefore I have clícked the right mouse button in the test_web project and selected WebService.

I'm not so sure what you are trying to do.

Let me tell you the way that I understand your problem.

  • Silverlight Project
  • TestWebProject ( ASPX Web Project )
    • SimpleWebService ( ASMX Web Service)

So, you have one ASP.NET project and Silverlight project. You have added one webservice item to ASP.NET project. Then, you add that webservice as a service reference in Silverlight project. When you compile the project, you got the error and two warnings. Is this what you have done?

If you are using ASMX web service, you shouldn't get this problem. but let's find out the  "AG_E_PARSER_BAD_PROPERTY_VALUE" exception first. Please remove all reference and run the application. Let us know whether you got the "AG_E_PARSER_BAD_PROPERTY_VALUE" exception or not. If that problem is solved, we will move on to ASMX webservice thing.

 

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Best Regards,
Michael Sync

Blog : http://michaelsync.net
Feed : http://michaelsync.net/feed

mchlsync

Loading...
Joined on 09-16-2005
Singapore
Posts 2,335
04-29-2008 9:54 AM
Re: It's not possible to add a Service Reference for my WebService

First, thanks for your answer.

mchlsync:

Let me tell you the way that I understand your problem.

  • Silverlight Project
  • TestWebProject ( ASPX Web Project )
    • SimpleWebService ( ASMX Web Service)

So, you have one ASP.NET project and Silverlight project. You have added one webservice item to ASP.NET project. Then, you add that webservice as a service reference in Silverlight project. When you compile the project, you got the error and two warnings. Is this what you have done?

 Correct (approximately)

  • Silverlight Application (Type: Web Application Project) (sln)
    • Silverlight (The Silverlight Project)
    • Silverlight_Web (Is created as a test environment from Visual Studio for the Silverlight Project)
      • Contains the standard WebService

Further details:

  • The Page.xaml file contains only a TextBox to show the result from the webservice
  • When I delete the added Service Reference for the WebService, I've got NO exception!
  • I'm using Windows XP Prof. SP2 with Visual Studio 2008 Professional and Silverlight 2 Beta 1

When I added the Service Reference and I open Page.xaml.cs it's not possible to create an new Object of the WebService to use a method. e. g. Service1 ws = new Service1()
I think the two Warnings are the reasons.

I have seen a video from Jesse Liberty. In this video he integrates a WebService in the same way. But I think he used Silverlight 1.1 Alpha. But his application works without problems Big Smile

I hope you have an answer. What's going wrong. Is it possible that the installation of my system has a failure? I need WebServices to write an application for my student research project. But I begin first when I know that WebServices in Silverlight works Wink

TomKid

Loading...
Joined on 04-15-2008
Karlsruhe (Germany)
Posts 12
04-29-2008 10:05 AM
Marked as Answer
Re: It's not possible to add a Service Reference for my WebService

It's strange. I have two ASMX + SL samples and WCF + SL sample in my blog. You may take a look if you want. I'm sure that we are able to consume the ASMX web service from Silverlight. maybe, you can send your sample to me. (My ID is mchlsync AT gmail DOT com ) ... I'm happy to take a look your sample....

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Best Regards,
Michael Sync

Blog : http://michaelsync.net
Feed : http://michaelsync.net/feed

mchlsync

Loading...
Joined on 09-16-2005
Singapore
Posts 2,335
04-29-2008 10:20 AM
Re: It's not possible to add a Service Reference for my WebService

Ok thanks. I will view your blog.

The warnings appear as soon as I click ok in the dialog where I can discover the web services. So, I have added the Service Reference.

I have no internet in my appartement therefore I will send you the project tomorrow.

Thanks.

TomKid

Loading...
Joined on 04-15-2008
Karlsruhe (Germany)
Posts 12
Microsoft Communities