Skip to main content

Answered Question Silverlight and WCF Web Service, HTTP 404, Beta 2RSS Feed

(1)

Mudu
Mudu

Member

Member

4 points

4 Posts

Silverlight and WCF Web Service, HTTP 404, Beta 2

I have a Silverlight Application which queries a WCF service (Basic HTTP Binding). The service is hosted in the web site which hosts the silverlight content too. After migrating the application to the Beta 2 of Silverlight 2, Service calls do not work anymore. The EndInvoke-method in the service client wrapper class throws a ProtocolException:

The remote server returned an unexpected response: (404) Not Found.

Since the server does not return a 404 if I open the SVC-file in my browser and Wireshark does not event capture a single HTTP request I'm afraid there is an issue with the Silverlight application itself. Everything worked well before upgrading to Beta 2.

It does not matter whether I open the Silverlight content locally (by hosting it in a web site which runs on ASP.NET Development Web Server) or from the remote IIS on which I deploy the web site. The web service that I invoke is always hosted on the remote web server.

Any help would be great!

Cheers,
Matthias

jhrecife
jhrecife

Member

Member

36 points

10 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I am facing the same problem. Anybody has a clue? 

hwsoderlund
hwsoderlund

Member

Member

423 points

119 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 I solved this by adding http-request-headers="*" to my clientaccesspolicy.xml (see example below). But I'm not sure why the problem occured in the first place. Anybody know?
 

I changed my clientaccesspolicy.xml from this:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from>
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

 

To this:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

NicolasBE2
NicolasBE2

Member

Member

6 points

3 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I've read that the addition of http-request-headers is one of the breaking changes, needed in Beta2.

However ... I'm having the same problem, adding the http-request-headers doesn't help for me.

My Silverlight app is deployed at http://localhost/mysilverlightapp

My WCF app is deployed at http://localhost/mywcfapp

It only works if I use both FQN (mypcname) to get the data. Doing a call from http://localhost/mysilverlightapp to http://mypcname/mywcfapp gives me a 404 error. (this is cross domain behaviour, isn't it ?)

Any help is welcome.

Thanks,

Nicolas

Mudu
Mudu

Member

Member

4 points

4 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Thank you for the reply. Yeah, it is one of the breaking changes.

I am going to update the policy file (just have little permission issue so far). Nevertheless I'm afraid this is not the solution, 'cause the Silverlight item does not seem to perform any HTTP requests (according to Wireshark).

simvouli
simvouli

Member

Member

26 points

16 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Just a hint - perhaps you find useful stuff here: http://blogs.msdn.com/brada/archive/2008/06/08/silverlight-roles-profile-and-authentication-example-updated-for-silverlight-beta2-now-with-visual-state-manager-vsm-goodness.aspx

Regards,

Simvouli

NicolasBE2
NicolasBE2

Member

Member

6 points

3 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Thanks for the link, indeed some interesting stuff on there.

I have however the same 404 issue.

Calling a WCF service from localhost/silverlightapp to localhost/wcfapp works.

Calling a WCF service from mycomputername/silverlightapp to mycomputername/wcfapp works.

Calling a WCF service from localhost/silverlightapp to mycomputername/wcfapp gives a 404.

Calling a WCF service from localhost/silverlightapp to othercomputername/wcfapp also gives a 404.

I've updated the clientaccesspolicy file with the new header parameter, restarted IIS, rebooted the machines, but the problem remains. Tongue Tied

Regards,

Nicolas

jhrecife
jhrecife

Member

Member

36 points

10 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I got my app working now.

Besides updating the clientaccesspolicy.xml file, I noticed that the communication with a WCF service only works when I am running the silverlight app on the context of a ASP.NET Application.

If when creating the silverlight project I choose to add a HTML test page instead of an ASP.NET, I can't get to communicate with any service (WCF or ASMX).

Can anybody else confirm if the same happens? Is it something normal?

 

 

simvouli
simvouli

Member

Member

26 points

16 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Confirmed (at least from my understanding). Because the Webservice is a server side service, your ASP.NET project Website must run somewhere on your localhost, before you can send requests to it.

eric_delahaye@hotmail.com
eric_del...

Member

Member

181 points

43 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I'm in the same situation and can not solve it

EriC#

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I can get my Silverlight on HTML page to call any WCF service, just make sure you are not running the HTML page using the URL like c:\MySilverlightProject\SilverlightPage.html. The HTML page has to be hosted by IIS or Dev Server, not using File access.

Make sure you set your web project as Start up project, and the HTML page is the start page. If you set the Silverlight project as Start up project then when you hit F5, you will be using  c:\XXXX\MySilverlightProject\SilverlightPage.html as the URL instead of  "http://" mode.

 

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I also have "The remote server returned an unexpected response: (404) Not Found." problem when I'm passing large data back to the WCF call.

The size limit is back, and the specifying the message size in the ClientConfig file dose not do anything as it supposed to do. In beta 1 I had to create a binding and set the message size on the Binding and call the WCF client constructor to pass this new binding. Now that code won't work in beta 2 either.  I just kept getting 404 error. If I limit my message size then the service works fine.

Anybody has seen the same problem? If you have UploadFile code, you should see this problem easily. 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

mforth
mforth

Member

Member

2 points

1 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I have spent the whole day trying to get my WCF working again (after upgrading to Beta 2).

I've tried everything that I've read about.. but so far.. no success.   A very sad day.  (Boss wants to reconsider if we are getting in too early..).  If anyone finds some more answers please, please do post. thx in advance.

check this related info:  http://silverlight.net/forums/t/17500.aspx    (but I have the 'good size' tools installed.. you'll have to read it - but some folk are reinstalling).

and this:  http://www.itwriting.com/blog/?p=665

 

11pm update:  I started a new Beta 2 project - and a vanilla WCF (simple/ test) was working.  I added code from the original project to hit the database and started getting the 404.  I finally realized that somehow my custom connection string was no longer in the appSettings or connectionStrings sections of my service's web.config.  I have a backup from b4 the upgrade.  I'll check tomorrow if they were intact b4 I started the upgrade.  So for me, the 404 was due to the fact that my connection string could not be found. 

 

 

NicolasBE2
NicolasBE2

Member

Member

6 points

3 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I actually found this morning the cause of my 404 errors.

I used fiddler to see what happens. Clientaccesspolicy got loaded in cross domain situations, but my clientaccesspolicy.xml contained a typo (<allow from tag got closed twice. I think I copied it from a site) after I added the http-request-headers attribute.

So no I can call a remote WCF service from my localhost Smile

eric_delahaye@hotmail.com
eric_del...

Member

Member

181 points

43 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I found MY problem,
With the Fiddler2 I realized that the clientaccesspolicy.xml was with errors. "Copy-Paste Error"
 
 

EriC#

Mudu
Mudu

Member

Member

4 points

4 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Many thanks for all your replies. But, in your scenarios the clientaccesspolicy.xml has been requested via HTTP, right? In mine no request is send, that's what makes it that strange. Thank you anyway...

egooge
egooge

Member

Member

5 points

2 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Thank you hwsoderlund, 

Adding:  <allow-from http-request-headers="*"> solved my problem.

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

sladapter:

I also have "The remote server returned an unexpected response: (404) Not Found." problem when I'm passing large data back to the WCF call.

The size limit is back, and the specifying the message size in the ClientConfig file dose not do anything as it supposed to do. In beta 1 I had to create a binding and set the message size on the Binding and call the WCF client constructor to pass this new binding. Now that code won't work in beta 2 either.  I just kept getting 404 error. If I limit my message size then the service works fine.

 

 

This issue is resolved too. see http://silverlight.net/forums/t/17674.aspx

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25054 points

2,747 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hello, something to try:

First make sure the cross domain policy file is under the root folder of the web server. For IIS, normally its C:\inetpub\wwwroot.

Then you can turn on WCF tracing by writing the configuration file like this (You may find it easier to use the "Service Configuration Editor" tool shipped with Visual Studio):

<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information,ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\logs\TracingAndLogging-service.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="xml" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>

After you run your application, as long as the request is made, no matter the response is correct or not, a log file will be created. In this case, it's C:\logs\TracingAndLogging-service.svclog. Then you can use the "Service Trace Viewer" tool to view the log. The most useful information is in the Message tab. If a request is successfully processed and response is made, the message is black. If anything went wrong, the message is red. If no log file is created, possibly no request was not even made...

You can find both tools under "Program Files\Microsoft SDKs\Windows\v6.0A\bin". If you're on Vista or Server 2008, simply search "service" in the Start Menu...

For more information, please refer to http://msdn.microsoft.com/en-us/library/ms733025.aspx.

 

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

dcstraw
dcstraw

Member

Member

258 points

85 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I get the 404 error even on my local system.  I am not running IIS - I am simply running the WCF service in the debugger.  For some reason I didn't get the "Silverlight-enabled WCF Service" template when I installed the beta 2 tools, so I created a WCF service and changed the binding from wsHttpBinding to basicHttpBinding.  The client discovers the service just fine, but when I try to create a client and make a service call, I get the 404 error.

Is there some other setting that needs to be changed in the WCF service to make it compatible with Silverlight 2 beta 2?  I don't have a clientaccesspolicy.xml, and I wouldn't know where to put it considering I'm not even running a web server.  I hope I don't have to install IIS to make this work in my development environment. 

[Edit: I found the "Silverlight-Enabled WCF Service" - It is only available in a web project, and I was trying to add it to a WCF Service Library project.  It seems like it ought to be in both]

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

You do not need clientaccesspolicy.xml if you are not making cross-domain call ( in your case should not be a cross-domain call). Check the url in your ServiceReference.ClientConfig file, the port number in the url (http://localhost:PORT#/ ) should be the same as the port number on your Page url. Otherwise it will be considered a cross-domain call.

That port number is dynamic, so it could be changed (if you stopped Dev Web) since you added your ServiceReference. If that is the case,  update your service reference should make them in sync. Or try to remove the reference then re-add it back.

If still not working, try to create your ServiceClient in code and pass the url in:

            System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();        
            System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(new Uri(Application.Current.Host.Source, "../YourService.svc"));
          
            var webService =  new YourWebSerive.YourWebServiceClient(binding, address);

This way the url will be always right.

 

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

dcstraw
dcstraw

Member

Member

258 points

85 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

sladapter:

the port number in the url (http://localhost:PORT#/ ) should be the same as the port number on your Page url. Otherwise it will be considered a cross-domain call.

Thanks!  I was running the WCF service in a separate web project so it was getting a different port number.  When I added the service to the same web project as the silverlight app, everything worked great.

Jonas Beckeman
Jonas Be...

Member

Member

24 points

44 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I have a similar problem (WCF and SL running in the dev environment, no IIS). The port is the same in both projects, and I've tried using clientaccesspolicy.xml. I don't get any 404:s though, I get an exception stating "An error occurred while trying to make a request to URI 'http://localhost:8731/Design_Time_Addresses/WcfServiceTMS/Service1/'. This could be due to a cross domain configuration error.".

Could it be that I'm trying to call directly from a Silverlight Application? Do I need to create a website to host the application? (I'm new to SL, and it's a long time since I've done *any* web development)

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

If you are not using IIS, you do not even have a place to put the cross-domain file.

You can try the method I posted: setting the address in the code, by-passing the clientconfig file reading.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jonas Beckeman
Jonas Be...

Member

Member

24 points

44 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Nope, not using IIS (should that have read "If you aren't using IIS"?).

I looked at your method, but I don't know what to put as the endpoint address - no .svc file seems to be generated by the WCF Service... Your code seems to indicate that it should be in bin folder? Here's the contents of Application.Current.Host.Source:

file:///C:/Users/JB/Documents/Visual%20Studio%202008/Projects/Project1/SilverlightApplication1/SilverlightApplication1/Bin/Debug/SilverlightApplication1.xap

 

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Sorry, I meant "if you are not using IIS".

Uri u = new Uri(Application.Current.Host.Source, "../YourService.svc");

Will be the correct URL if your  Service.svc file in under your Web Project root. If it is under a subfolder, add subfolder to the path:

Uri u = new Uri(Application.Current.Host.Source, "../SubFolder/YourService.svc");

Put a break point at this line, check the uri generated after you run this line of code. 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Answered Question

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Ok, one thing I noticed in your post is the URL has "file://" in it. You are not running http mode. Set your Web project as start project, not your Silverlight project. Then try it.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

theotherjay
theotherjay

Member

Member

22 points

24 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I have noticed something interesting with how sl2Beta2 looks for policy files.  I originally had an sl2Beta1 application calling a webservice on a different server.  The remote server held a crossdomain.xml file in the root web folder (wwwroot by default).  This is the proper location for this file as it is supposed to be used for all applications in that web server.  Upon updating the silverlight app to Beta 2 as well as modifying the crossdomain.xml file to the new syntax (in order to allow headers):

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="* " headers="*" />
</cross-domain-policy>

 I began receiving the common 404 error found in x-domain calls.

I built a test web service that only returned a string value as well as a test sl2beta2 app to call that webservice.  I deployed this webservice to the same web server as my original webservice was deployed.  Upon testing I still received the 404 error.  So, I tried putting a clientaccesspolicy.xml file in the application folder of the webservice using the new syntax:

  <?xml version="1.0" encoding="utf-8" ?>
- <access-policy>
- <cross-domain-access>
- <policy>
- <allow-from http-request-headers="*">
  <domain uri="*" />
  </allow-from>
- <grant-to>
  <resource path="/" include-subpaths="true" />
  </grant-to>
  </policy>
  </cross-domain-access>
  </access-policy>
 
Still, I received the 404 error.  I used fiddler to determine what exactly was being looked for and found that the clientaccesspolicy.xml file is searched, but it is NOT searched for at the application level.  My app was looking for it in the root web server folder.  So, I placed it in the root web server folder and voia la!  I could access my web service with no problems.
 
Would someone else please attempt to reproduce this?  To summerize:
The silverlight app checked the web server's root folder for clientaccesspolicy.xml.  If found and had proper syntax, then webservice was accessible.  Otherwise no webservice access.
The app still checked for the crossdomain.xml file in the root web server folder but didn't process the crossdomain.xml file.
No policy files were looked for in the application folder.
 
 
From everything I've read and done with sl2beta1, this new behavior is not accurate. 

Jonas Beckeman
Jonas Be...

Member

Member

24 points

44 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

sladapter:

Ok, one thing I noticed in your post is the URL has "file://" in it. You are not running http mode. Set your Web project as start project, not your Silverlight project. Then try it.

Yes, as noted before I don't have a Web project, just an application. So should I create a Silverlight Script Web and reference my Application from there?

(Tried that, added a reference, and xmlns:uc="clr-namespace:SilverlightApplication1;assembly=SilverlightApplication1.dll" to the Scene.xaml, but the namespace still isn't available in the xaml...)

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

You do not have a Web project? Where is your SilverlightTestPage.html? And where did you add your WCF? I'm lost now. Did you say you have two projects? What is other one beside the Silverlight project? You can not add a Web Site if you do not have IIS, but you still can create a Web Project.

Anyway, you can not call any webservice in File mode. It has to be in http mode.

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jonas Beckeman
Jonas Be...

Member

Member

24 points

44 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

The solution just has the Silverlight Application and the WCF project, but I've just now added a "Silverlight Script Web" and am trying to reference the Application from there, no luck so far though.
(Edit: I should take this particular problem to another thread)

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

If you already have a WCF project, then that is your Web project. You do not need another one. Just set that project as your start up project. Set the SilverlightPage.html in that project as start page. Then F5. Now your Page url should be something like http://localhost:XXXX/silverlightPage.html instead of File://XYZ .

Do not add another project and put WCF there. That will cause cross-domain issue. Because it will be running on a different port then the Page if the html Page and WCF on two different projects.

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jonas Beckeman
Jonas Be...

Member

Member

24 points

44 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Ah - my WCF project has no html page, it was started from a Project (not Web Project) WCF Service template (the only WCF tutorials I could find were based on that). What kind of template should I use? The Web Project WCF Service template doesn't have a SilverlightPage.html...

Would it not be possible to use the Silverlight Script Web as the template for the client project? Or will it not be able to communicate with the WCF service? And can a Script Web not use controls in a referenced Silverlight Application? I'm confused with all the alternatives here. But that is more related to my post here I guess: http://silverlight.net/forums/t/18109.aspx

Thanks,
Jonas

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I don't know how you run your page and did the all the testing. Have you done the following at all? If not, just do it.

Add Silverlight link to the WCF project (under project property page, last tag), you have only one Silverlight project in your solution, so just add that. It should create a SilverlightTestpage.html to your WCF project. Use that as your Start page.

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jonas Beckeman
Jonas Be...

Member

Member

24 points

44 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I used a WCF Service Project, not a WCF Service Web Project. It's not possible to add any Silverlight references to the former, but I have now created a new one (Web Project) and there I can add the Silverlight reference. Oh, the permutations possible herein..!

Now I get another host of other errors. I'll probably try to start anew next week. Thanks so much for your help so far, sladapter, you've gotten me on the right track at least, but right now I'm just overwhelmed with how complicated things are with Silverlight, I'm going to need a little break from it.

Thanks,
Jonas

Kostja
Kostja

Member

Member

38 points

16 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I have the same problems as U

Could U tell me please , your "Copy Past" error?Maybe it`s my problem

daxsorbito
daxsorbito

Member

Member

12 points

6 Posts

Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

sladapter:

sladapter:

I also have "The remote server returned an unexpected response: (404) Not Found." problem when I'm passing large data back to the WCF call.

The size limit is back, and the specifying the message size in the ClientConfig file dose not do anything as it supposed to do. In beta 1 I had to create a binding and set the message size on the Binding and call the WCF client constructor to pass this new binding. Now that code won't work in beta 2 either.  I just kept getting 404 error. If I limit my message size then the service works fine.

 

 

This issue is resolved too. see http://silverlight.net/forums/t/17674.aspx

 

Hi sladapter,

Could you now retrieve large data back from a WCF call?

It seem I could not make it work on my case and also I could not access the link that you've provided. Can you tell me what's your solution on this? or did you do anything special on this?

Thanks.

SteveWong
SteveWong

Contributor

Contributor

6443 points

1,297 Posts

Silverlight MVP
Answered Question

Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 The link is this

http://silverlight.net/forums/t/17674.aspx

Then, you should be reminded for some things

  • Bind your Web.config inside webservice with bindingConfiguration="LargeBuffer" where LargeBuffer is declared like this
       <bindings>
          <basicHttpBinding>
            <binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
               maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
          </basicHttpBinding>
        </bindings>


  • Then, inside ServiceReferences.ClientConfig, you should have this
    <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_Buffer" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="None" />
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://3water/SteveWeb/SteveService/Service.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Buffer"
                    contract="SteveSLWeb.SteveWebService.IService" name="BasicHttpBinding_Buffer" />
            </client>
        </system.serviceModel>


  • The most important thing here is to make sure your webservice and your web is in the same port [yourweb]:#port if they are in the different ones, errors should occur. By the way, you can use IIS to host your Web, and the trick can be easily done. Moreover, if you use IIS, make sure you have put the clientaccesspolicy.xml onto the wwwroot with this format
    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from http-request-headers="*">
            <domain uri="*"/>
          </allow-from>
          <grant-to>
            <resource path="/" include-subpaths="true"/>
          </grant-to>
        </policy>
      </cross-domain-access>
    </access-policy>

 

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

Client App Dev

Mudu
Mudu

Member

Member

4 points

4 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Thank you for all replies! Interestingly it it actually was some kind of cross-domain issue. sladapter, special thanks for your solution too. I'll keep it in mind for the future, but it did not fit to my specific current scenario in which the URL should be stored in the client configuration file (which is finally supported by the new Beta).

My problem is now solved, by making a bloody simple change in the service URL in the config file: I entered the service URL with the current domain: "http://webserver.contoso.com/..." instead of "http://webserver/..." only. This change made it work, I'm sure it has something to do with the cross-domain configuration, but I can't just reconfigure this (policy, you now). Stupid fault, hrmpf...

Thank you to everybody, once again, cheers!

Matthias

Monimom
Monimom

Member

Member

8 points

4 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I also Solved  below exception .

"The remote server returned an unexpected response: (404) Not Found. "

i run both web service project and my silverlight 2 beta 2 project  in the localhost .

my app was running without any errors and exceptions, when  closed visual studio and

re-opened project i got the above error .. and i tried updating the service too ... but it didnt help.

it is because your "ServiceReferences.ClientConfig"  file in your silverlight project points to the old endpoint address .

<client>
            <endpoint address="http://localhost:2966/SearchService/Service.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
                contract="SerchServeSL.SLService.IService" name="BasicHttpBinding_IService" />
        </client>

 change it to the new port number that your Asp.net project is hosted .........

 

that solves the problem Big Smile .

 

 

 

 

 


 

 

Mohan

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi

i'm facing the same problem.  my policy file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

I've tried an enpoint config like this:

<endpoint address="http://adamantium.redmond.corp.microsoft.com/Sites/silverlightsamples/RemoteEcho.svc"

binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_RemoteEcho"

contract="SilverlightSamples.test.RemoteEcho" name="test_echo" />

 

and this:

<endpoint address="http://adamantium/Sites/silverlightsamples/RemoteEcho.svc"

binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_RemoteEcho"

contract="SilverlightSamples.test.RemoteEcho" name="test_echo" />

The above worked fine on win2k8 and stopped working when I tried to run th same code on Vista. I used Fiddler2 and it seems to find clientaccesspolicy.xml, but I only get the 200 response code AFTER it fails on the silverlight app.  I've got my app running in debug mode through a asp.net site on port 65000 and i'm just trying to connect to the same site (I deployed it to IIS first) running on IIS. 

What am I doing wrong ?!?!?!?!?!

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

moemeka:

Hi

i'm facing the same problem.  my policy file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

I've tried an enpoint config like this:

<endpoint address="http://adamantium.redmond.corp.microsoft.com/Sites/silverlightsamples/RemoteEcho.svc"

binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_RemoteEcho"

contract="SilverlightSamples.test.RemoteEcho" name="test_echo" />

 

and this:

<endpoint address="http://adamantium/Sites/silverlightsamples/RemoteEcho.svc"

binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_RemoteEcho"

contract="SilverlightSamples.test.RemoteEcho" name="test_echo" />

The above worked fine on win2k8 and stopped working when I tried to run th same code on Vista. I used Fiddler2 and it seems to find clientaccesspolicy.xml, but I only get the 200 response code AFTER it fails on the silverlight app.  I've got my app running in debug mode through a asp.net site on port 65000 and i'm just trying to connect to the same site (I deployed it to IIS first) running on IIS. 

What am I doing wrong ?!?!?!?!?!

I found a great fix that solves the problem: delete clientaccesspolicy.xml and just use crossdomain.xml.  Since cross domain is much more stable and actually has an xposed schema you validate against.  I did this and everything worked prfectly.  I guess this means there was something I was doing wrong in my configuration of clientaccesspolicy.xml.  That's really strange since is copied it from here: http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx

 

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com

SteveWong
SteveWong

Contributor

Contributor

6443 points

1,297 Posts

Silverlight MVP

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Monimom:

I also Solved  below exception .

"The remote server returned an unexpected response: (404) Not Found. "

i run both web service project and my silverlight 2 beta 2 project  in the localhost .

my app was running without any errors and exceptions, when  closed visual studio and

re-opened project i got the above error .. and i tried updating the service too ... but it didnt help.

it is because your "ServiceReferences.ClientConfig"  file in your silverlight project points to the old endpoint address .

<client>
            <endpoint address="http://localhost:2966/SearchService/Service.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
                contract="SerchServeSL.SLService.IService" name="BasicHttpBinding_IService" />
        </client>

 change it to the new port number that your Asp.net project is hosted .........

that solves the problem Big Smile .

 

 

Ya that's right. That's why I always encourage people to host their Service on IIS or simply Publish it and make sure  the endpoint address is correctly pointing. It is really putting your project and your work in a right way.

 

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

Client App Dev

cncolder
cncolder

Member

Member

45 points

29 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I have the save problem as yours.

When I create LINQ to SQL, I got a class named "Component" from table (8 columns).
And then, I fill some random Components to a DataGrid.
I try to update them to WCF service carefully. Different row each time.

I see an exception Until "rows > 176".
The limit row is 176. At this time, there is 650kb datas in Firebug. 650kb = 665600byte
But I have set the maxBufferSize to 2147483647.




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
http://www.ViTarn.com/

simonhazelgrove
simonhaz...

Member

Member

18 points

4 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I'm having a similar issue here - I am accessing an existing production web service that I have no control over.  This web service already has a correct crossdomain.xml file - it is currently used by a flash app.

I am getting a 404 error when my silverlight app is looking for crossdomain.xml - it is looking in the root folder of the production server, but the file exists in the app folder of the web service.

Since I have no control over the service - can I force my silverlight app to look in the services app folder for the crossdomain file?

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Could you put the url of the crossdomain file for your web service in a browser to check the content of that crossdomain.xml file?

The url should be something(change the domain to the real one) like http://[yourservicedomain]/crossdomain.xml and report back what is the content of that file?

Because SL2 beta 2 requires this file to be updated. The old file might still work for Flash and SL2 beta1, but not for SL2 beta 2.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

simonhazelgrove
simonhaz...

Member

Member

18 points

4 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

The issue is the location of the crossdomain.xml file - something I cannot control.

I have a production webservice, at this address:

http://mydomain.com/UIService/service.asmx

and crossdomain.xml is here:

http://mydomain.com/UIService/crossdomain.xml

 the contents of which are:

<?xml version="1.0" encoding="utf-8" ?>
<cross-domain-policy>
      <allow-access-from domain="*" />
</cross-domain-policy>

I know silverlight is looking for crossdomain.xml at http://mydomain.com/crossdomain.xml - however it is not there, and due to the way the server is setup (multiple host header sites, root requires SSL, web service has SSL traffic denied, etc) it will never be able to find the file anywhere other than in the webservice's app root.

Its a shame, I'm creating a demo of my companies POS system (which is currently flash) - at the moment we will not be able to provide a silverlight option using the existing back end.

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I think the problem is with the file itself, not the location. They could have configured http://mydomain.com/UIService/  as the domain. The new file should look like the following in order to work with SL2 beta2 (yours missing headers attribute), you need to notify your service provider to update their policy file.  I know several people using public service had the similar issue. They solved this problem by asking their service provider to update that file.

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM

  "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

  <allow-http-request-headers-from domain="* " headers="*" />

</cross-domain-policy>

 


 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

silverlight_ria
silverli...

Member

Member

10 points

9 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi all,

This is my first posting in this forum. I have a written a small app using Silverlight 2 Beta 2, WCF (.NET 3.5), C# 2008 and SQL Server 2005 Express.

In my business object, I derive my public classes from my defined interfaces:

    [DataContractFormat]
    [ServiceContract]
    public interface IExpenseType
    {
        [OperationContract(Name="InsertExpenseType")]
        int Insert(ExpenseTypeInfo expenseTypeInfo);
        [OperationContract(Name="UpdateExpenseType")]
        void Update(ExpenseTypeInfo expenseTypeInfo);
        [OperationContract(Name="DeleteExpenseType")]
        void Delete(int expenseTypeId);
        [OperationContract]
        List<ExpenseTypeInfo> View();
        [OperationContract(Name="ViewByExpenseType")]
        List<ExpenseTypeInfo> View(string expenseType);

My WCF looks like this:

    [DataContractFormat]
    [ServiceContract]
    public interface IExpenseTracker : IExpenseType, IExpense
    {

    }

and

    [DataContract]
    public class ExpenseTracker : IExpenseTracker
    {

        List<ExpenseTypeInfo> IExpenseType.View()
        {
            IExpenseType expenseType = new ExpenseTypes();
            return expenseType.View();
        }

    }

For illustrative purposes, I'm not including other methods.

In my silverlight app, I do a Service reference and clicking on OK button on the dialog gives me a warning:

Warning 1 Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Path: C:\......Reference.svcmap.

At this point, I have no idea what this warning is all about. i have also added DataMember attributes in my public properties class. (ExpenseTypeInfo listed above).

Things don't stop here:

I'm breaking my head when I run my silverlight web app and when I call the View method (listed above), I get a nasty error on the EndInvoke line:

            public System.Collections.ObjectModel.ObservableCollection<ExpenseTracker.ExpenseTrackerWSProxy.ExpenseTypeInfo> EndView(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<ExpenseTracker.ExpenseTrackerWSProxy.ExpenseTypeInfo> _result = ((System.Collections.ObjectModel.ObservableCollection<ExpenseTracker.ExpenseTrackerWSProxy.ExpenseTypeInfo>)(base.EndInvoke("View", _args, result)));
                return _result;

Protocol exception was unhandled by user code: The remote server returned an unexpected response (404) Not Found.

I'm running on ASP.NET local development server and the for the ASP.NET web site (the page that has the object tag to host silverlight app) runs on http://localhost:34247 while the configs for the other projects are displayed like this:

<host>

<baseAddresses>

<add baseAddress="http://localhost:8731/Design_Time_Addresses/ExpenseTracker.WebService/ExpenseTracker/" />

</baseAddresses>

</host>

ServiceReferences.ClientConfig lists this:

<configuration>
    <system.serviceModel>
        <client>
            <endpoint address="http://localhost:8731/Design_Time_Addresses/ExpenseTracker.WebService/ExpenseTracker/"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IExpenseTracker"
                contract="ExpenseTracker.ExpenseTrackerWSProxy.IExpenseTracker"
                name="BasicHttpBinding_IExpenseTracker" />
        </client>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IExpenseTracker" maxBufferSize="65536"
                    maxReceivedMessageSize="65536">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
    </system.serviceModel>
</configuration>

Please help. I infact changed all config to have the same port numbers but didn't help. Also configured ASP.NET web site development server to use fixed port  number and that didn't help either.

 

 

 

 

rajesh shirpuram
rajesh s...

Contributor

Contributor

2315 points

507 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

hi silverlight_ria,

1) I had faced "LoaderExceptions" and is mainly because of we are returning something which are not serializable (as was in my case and it resolved my problem).

2)  And as for this

"

I'm breaking my head when I run my silverlight web app and when I call the View method (listed above), I get a nasty error on the EndInvoke line:

            public System.Collections.ObjectModel.ObservableCollection<ExpenseTracker.ExpenseTrackerWSProxy.ExpenseTypeInfo> EndView(System.IAsyncResult result) {
                object[] _args = new object[0];
                System.Collections.ObjectModel.ObservableCollection<ExpenseTracker.ExpenseTrackerWSProxy.ExpenseTypeInfo> _result = ((System.Collections.ObjectModel.ObservableCollection<ExpenseTracker.ExpenseTrackerWSProxy.ExpenseTypeInfo>)(base.EndInvoke("View", _args, result)));
                return _result;
"

 

Check the return type  from your web service and e.result return type in completed event of web service call.If it doesn't match Right Click on ServiceRefernce in the solution explorer and configure the web service. there you will see options to configure it.

 

 

Thanks
Rajesh Shirpuram

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

silverlight_ria
silverli...

Member

Member

10 points

9 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I wanted to eliminate the warning that I get which is causing me concern. I had done my best to take all reqd steps (DataMember, DataContract, ServiceContract, DataContractFormat etc). How do I retrieve LoaderExceptions property and what is it actually?

 Also, I tried to change the return type from ConservableCollection to List and it still didn't solve the ProtocolException error.

 Please help me. I'm done with my SL app and the WCF interaction is killing me really.

 

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

First make sure you use a very simple Service code to test your Service connection if this is your first attempt to call WCF service.  That 404 error is mainly Service connection error. So before you putting any complicated code or Data Type in your service, follow the steps below:

1) Just add a Silverlight Enabled WCF to your Web project. It should have DoWork function. You change that DoWork function take one string paramerter and return the same string.

[OperationContract]
        public string DoWork(string input)
        {
            // Add your operation implementation here
            return input;
        }

2) Add Service Reference to your silverlight project point to this simple WCF service.

3) Add code in your silverlight project to call this WCF service. Make you Web project as your start project. your silverlightTestPage.html/(or aspx) as as your start page. Hit F5 to test your app.  You should be able to call this service without any 404 error.

If you can hit your service without problem your connection is fine. Before you move on, make sure you change your service calling code to the following:

           //var webService =  new YourWebSerive.YourWebServiceClient(); // this is your original code, comment out this line,

            System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();        
            System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(new Uri(Application.Current.Host.Source, "../YourService.svc"));
          
            var webService =  new YourWebSerive.YourWebServiceClient(binding, address);// Set the address in the code, so to avoid a lot of cross-domain troubles later on.

4) Test your code again make sure everything still works. Now you can add your real service code.

Remember everytime you change your service code, make sure to update your service reference (sometime, it's better to remove the service reference and re-add it back) in your Silverlight project.

 

 

 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

silverlight_ria
silverli...

Member

Member

10 points

9 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

You are right.

 Removed all my complex code and then added a simple DoWork() method as shown below. This time no Business Object or anything. just plain WCF service:

[DataContractFormat]

[ServiceContract]

public interface IExpenseTracker //: IExpenseType //, IExpense

{

[
OperationContract]

string DoWork(string input);

}

//[OperationContract]

//List<ExpenseTypeInfo> View();

}

and

[DataContract]

public class ExpenseTracker : IExpenseTracker

{

#region IExpenseTracker Members
string IExpenseTracker.DoWork(string input)

{

// Add your operation implementation here

return input;

}

#endregion

}

 

Same story. I added service reference from SL and clicked OK in the dialog. It still gives me a warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions prop for more info. Also, when calling the service, throws ProtocolException: 404 Not Found error.

I didn't try the binding code you had mentioned. Do I still need to try it at this point as the basic service reference is failing.

thanks.

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Check your Web.Config. Open your Web.Config using WCF Service Configuation Editor under Tools tab. Make sure the  binding for your service endpoint is BasicHttpBinding.

Then try to add service reference again.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

If you just add a Silverlight Enabled WCF service would be much simpler. If you still want to use the regular WCF service, make sure your code looks like this:

IExpenseTracker.cs:

[ServiceContract]    
    public interface
IExpenseTracker
    {
        [OperationContract]
        string DoWork(string input);
    }


ExpenseTracker.svc.cs:

 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class ExpenseTracker : IExpenseTracker
    {        
        public string DoWork(string input)
        {
            return input;
        }
    }

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

silverlight_ria
silverli...

Member

Member

10 points

9 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I created a new bare bone app. First created a new WCF Service project, changed the DoWork method to return a string. Implemented the method in my WCF class and returned a hard coded string. Added a new SL project, selected WebSite option and also selected Web Application project which also created a ASP.NET web application project for me. Added a button to the Page.xaml. Added Service Reference and it threw the same warning. This time, I started FUSLOGVW.EXE and logged all binding failures and discovered that one of the assemblies failed to load as it does not exist:

*** Assembly Binder Log Entry  (7/14/2008 @ 2:44:31 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\WcfSvcHost.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = <user name>
LOG: DisplayName = System.Xml.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
 (Fully-specified)
LOG: Appbase = file:///C:/Users/<username>/.NET apps/testsl/basicSer/basicSer/bin/Debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\<username>\.NET apps\testsl\basicSer\basicSer\bin\Debug\basicSer.dll.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Post-policy reference: System.Xml.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/<username>/.NET apps/testsl/basicSer/basicSer/bin/Debug/System.Xml.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/Users/<username>/.NET apps/testsl/basicSer/basicSer/bin/Debug/System.Xml.XmlSerializers/System.Xml.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/Users/<username>/.NET apps/testsl/basicSer/basicSer/bin/Debug/System.Xml.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/Users/<username>/.NET apps/testsl/basicSer/basicSer/bin/Debug/System.Xml.XmlSerializers/System.Xml.XmlSerializers.EXE.
LOG: All probing URLs attempted and failed.

I'm just wondering whether there is any physical DLL file (System.Xml.XmlSerializers.DLL) and also why does the .NET runtime search in Framework64 folder. I also searched my entire machine and
couldn't find this DLL. Why is this assembly missing and is it part of .NET 3.5 or 3.0 or 2.0 framework?
Btw, I already started changing the binding protocol to basicHTTPBinding when I created my first posting here.
Thanks.
 

silverlight_ria
silverli...

Member

Member

10 points

9 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Update:

 I created a Console app and did Add Service Reference and this time there were no warnings generated. So, I definitely know now that there is some issue with SL's Add Service Reference when referencing any kind of web service. Anybody know what the problem is?

 

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

System.Xml.Serialization.dll should be under: C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client\System.Xml.Serialization.dll

If you can not find this file, you might need to reinstall your Silverlight SDK.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Ragnaroek
Ragnaroek

Member

Member

5 points

2 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 I get a 404 error with the Amazon Webservice.

There crossdomain.xml is here: http://webservices.amazon.com/crossdomain.xml

The error message is:

"The remote server returned an unexpected response: (404) Not Found."

   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at BookSearch.AWSReference.AWSECommerceServicePortTypeClient.AWSECommerceServicePortTypeClientChannel.EndItemSearch(IAsyncResult result)
   at BookSearch.AWSReference.AWSECommerceServicePortTypeClient.BookSearch.AWSReference.AWSECommerceServicePortType.EndItemSearch(IAsyncResult result)
   at BookSearch.AWSReference.AWSECommerceServicePortTypeClient.EndItemSearch(IAsyncResult result)
   at BookSearch.AWSReference.AWSECommerceServicePortTypeClient.OnEndItemSearch(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

 and my settings are:

<endpoint address="http://soap.amazon.com/onca/soap?Service=AWSECommerceService"
                binding="basicHttpBinding" bindingConfiguration="AWSECommerceServiceBinding"
                contract="BookSearch.AWSReference.AWSECommerceServicePortType"
                name="AWSECommerceServicePort" />

 Is there anything I can do, or is it a Amazon configuration fault (I doubt that).

Any hint is welcome!

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Ragnaroek:

 I get a 404 error with the Amazon Webservice.

There crossdomain.xml is here: http://webservices.amazon.com/crossdomain.xml

<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>

 

That crossdomain.xml file is not compatible with SL2 beta 2. The correct crossdomain.xml for SL2b2 should be:

<cross-domain-policy>
   <allow-http-request-headers-from domain="* "headers="*" />
</cross-domain-policy>

Amazon need to update their crossdomain.xml file for Silverlight app to access it.

Or you write a WebService to access it then you call your WebService.

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

SASilver
SASilver

Member

Member

46 points

29 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi,

I have this problem that the service reference doesnt expose the client stub for me to create an instance of the service. 

The layout of my project is as below

1) Library that has the DataContracts

2) Silverlight UI project

3) Web project for the silverlight project and

4) WCF service application ( seperate project outside the web project)

I have created it this way since its my need. :)

I am able to right cliek the svc file and view it in the browser. The browser shows me the client stub.

Now i am able to run the service successfully and add a service reference to the silverlight UI project. But it shud expose the ServiceClient stub for me to create the instance. Instead it shows me a few classes i am using in the service.

Haven't been able to fix it..

Please help !!

 

 

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi,

  you don't need a generated client stub to use the service.  Just use ChannelFactory and create the client from the Interface.  It gives you more flexibility anyways.

Here is a sample:

ChannlFactory<your_interface> factory = new ChannelFactory<your_interface>();

//configure the channel factory in anyway you desire

your_interface channel = factory.CreateChAnnel();

//call functions on your interface.

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com

SASilver
SASilver

Member

Member

46 points

29 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Ohh ! That worked on a reference that exposes the client. When i  tried it on my problem i.e the reference that doesn't expose the client functions, it failed to work.

What i tried was

ChannelFactory<projectName.UI.ServiceReference2> channelfactory = new ChannelFactory<projectName.UI.ServiceReference2>;  [The interface name of is IUPAService, but i guess i'll have to give in the reference name]

projectName.UI.ServiceReference2 client = channelfactory.CreateChannel(); [b'coz this is what is exposed]

client. ___ [I dunt find any functions from the service]

Any views on this ?

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi,

  I think you are missing the point here.  You have 3 options here:

1) You need to design the service such that it can be consumed by a client without the need of generated proxies.  To do this, create a service contract as a seperate interface (by default if you create services in a web application the service and contract are one and the same).  This contract should be in an assembly that will be shared between your service code and the client code.  Now on the client side reference that assembly and use the interface as the type argument for the ChannelFactory

2) Dont bother yourself with creating a service contract on the server side, just define an interface on the client side with the same interface as the service (meaning same public functions with exactly the same paramaters).  Use that in your channlfactory creation as the type argument

3) If you really want the generated proxy fro some reason, use svcutil (or some other proxy generation tool) to genrate one outside of visual studio then simply add the generated cs file to your silverlight project.

This could be because i'm old fashioned and not into all this dynamic generation stuff, but I would recommend option#1 because it is both flexible and stable.  Option#2 is equally flexible, but if you have more than one client using this method, changes to the service will require you to modify the client side interface you have created for it one each client. ouch!  Option#3 is great if you dont mind loosing internal knowledge of how WCF works and leaving it all up to the VS team to make it all magically work.  Look where that got you Wink.  Seriously though, use option#1

[<b>edited by:</b> moemeka at 4:43 PM (GMT -5) on Fri, Jul 25 2008]
By the way, I mean absolutely no disrespect to the awesome work the VS team has done.  I have the otmost respect for their efforts, inovations, and desire to make developers more productive.  I&#39;m sure at some point when this goes live all these interim issues will be resolved. Thanks for all the hard work, awsome tools, and great support!

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com

eric_delahaye@hotmail.com
eric_del...

Member

Member

181 points

43 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

The Option 1 is the best, but in Silverlight world the contract assembly can't be shared between your service code and the client code.... then?

EriC#

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

change the project type -> build -> reference. 

silverlight: 

<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" />

non-silverlight:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com

enantiomer2000
enantiom...

Member

Member

41 points

60 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Could be a little more explicit on this step of Import Project... I assume that is in the csproj file that you should add the Import Project lines?

 In my project, my goal is to be able to reference my service interface project class library from silverlight and from the actual service project.  Will this step allow me to do this? 

 If you could elaborate more on this, that would be helpful.

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

You can not add direct reference of your Service project to your Silverlight project. Because Silverlight is running on client side, Service is running on Server.

You can, however, add ServiceReference of your Service to your Silverlight project. Once you add Service Reference to your Silverlight project, you can call all the public mathod of your Service and create all the DataObject you marked as DataContract in your service project if those DataObject are exposed by your Service code.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

enantiomer2000
enantiom...

Member

Member

41 points

60 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Please look at the comment by MoeMeka at 07-25-2008 12:10 PM a few comments back.  He seems to indicate that you can do this through channels without generating a proxy.  That was what my question referred to.  Channels are much more effective to me as I can reference the actual business objects.

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

enantiomer2000:

 Please look at the comment by MoeMeka at 07-25-2008 12:10 PM a few comments back.  He seems to indicate that you can do this through channels without generating a proxy.  That was what my question referred to.  Channels are much more effective to me as I can reference the actual business objects.

Hi,

  it's a hack to get around the fact that silverlight projects cannot reference non-silverlight projects.  To accomplish this, change the in-between project file (the library file that contains all your shared interfaces) so that it is viewed my visual studio (msbuild) as a silverlight project.  Once that's done build the dll.  Actually, the easiest way to do this is just to add the following node to as a child node of any propertygroup :

<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

once the project reloads, you can reference it in any SL project (you'll know by the little web globe that appears on the top rleft of the normal project icon).  The nice thing about this is that it appears that VS will treat any projects referenced by a SL project as a SL project even if it rally isnt.  So at this point you can remove the node you previously added and all will still be well, (you still see the SL project icon).

So what's so cool about this? well it turns out that in this bizare state you can get the in-between project to build as either a SL library or regular library by either building the project by itself (produces regular dll) or building any SL project that references it (produces an SL dll).  The one catch is that you will not be able to project-reference it to a regular exe or library project (you can however reference to produced dll by using the browse tab of the references dialog).

.. and that's how the dog ate my homework.

Hope this helps.    

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com

enantiomer2000
enantiom...

Member

Member

41 points

60 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 @moemeka

 There seems to be some important differences between the Silverlight and full .Net framework versions of System.Serialization.Runtime and System.ServiceModel.  For one thing, ChannelFactory has different CreateChannel signatures.  I tried doing what you suggest but it kept giving me problems with conflicting assemblies.  It seems like I will probably have to reference the Silverlight versions in all my projects (the wcf interface project and the business entity project) because the silverlight project can ONLY reference the silverlight types, but I keep getting issues with this.

 When it comes down to is, all i really care about is when I call my service, I get my actual business object back...

Jami
Jami

Member

Member

11 points

6 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I got SL beta 2.

When i try to send large data to the WCF service, i get "The remote server returned an unexpected response: (404) Not Found." this error.

It works perfectly with small amout of data.

Tried maximising the maxBufferSize and maxReceivedMessageSize = "2147483647" in both web.config and references.clientconfig.

I  see you also encountered a similar issue and then you marked it as resolved.

There is no file found error on clicking the solution link you pasted there, http://silverlight.net/forums/t/17674.aspx

What is the solution?

 

Thanks,

Santosh Jami

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Try this one:

http://silverlight.net/forums/p/21513/76994.aspx#76994

or this one:

http://silverlight.net/forums/t/17674.aspx

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jami
Jami

Member

Member

11 points

6 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Answered

BigDubb
BigDubb

Member

Member

70 points

82 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 I too am encountering this issue...

 Before I get the obvious responses I'll throw some info out.

  • Yes, I am only doing BasicHttpBinding on the endpoint declaration
  • Yes I am hosting the WCF service on an IIS server, not locally
  • Yes I have tried both clientaccesspolicy.xml and crossdomain.xml and neither had any effect
  • Yes I have used Fiddler to inspect the traffic and I am only getting responses of 200.
  • I also am using WebDeveloper plug in for network traffic sniffing in IE and am getting the same results. 
  • Yes the service is consumable and returns result via console application, aspx page, and winforms application
  • Yes I have tried implementing a simple method string HelloWorld(), which clearly just returns "hello world", and am still getting 404 error.
  • Yes return types match.
  • I am able to build and present the project with no errors without any service assiciation
  • thinking that it might be the WCF service i rewrote the service as an ASMX service and am getting the same error on the same event, On the EndMyMethodName method. 
  • The methods on the service are visable via the WSDL and VS sees them and exposes them, both MyMethodAsync and MyMethodCompleted event
  • The solution was started with a WCF Service, then added the console project, then added Siliverlight Application

Solution contains:

  •  SilverlightApplication project
  •  WebPage project (silverlight presentation) this is teh start up project
  •  Silverlight Control project
  •  WCF Service Project (just the IServce.cs and Service.cs files)
  •  WCF WebSolution (just the web.config file, reference to the previous project and service.svc file which points to the dll from previous project)
  •  Console application (for testing purposes)
  • I have removed and readded references to silverlight libraries
  • I have downloaded and installed the VS2008 SP 1, .Net 3.5 update and reinstalled Silverlight SDK

So in short, I can't get a silverlight project to capture the return result from any service, ASMX or WCF, which are consumable via other methodologies. This feels as if it has something to do with the silverlight application.

I have downloaded an example project where Silverlight talks to ASMX service and that compiles and runs perfectly fine, so it has nothing to do with libraries etc. I checked the references  across solutions and things are identical. 

Does anyone have any ideas before I scrap this and move to Flex, this has consumed the better part of two days.

 

hwsoderlund
hwsoderlund

Member

Member

423 points

119 Posts

Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Try turning on WCF tracing and see what the log file says. It is mentioned earlier in this thread:

http://silverlight.net/forums/p/17733/81058.aspx#60320

BigDubb
BigDubb

Member

Member

70 points

82 Posts

Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

I added WCF Tracing and found the source of the error..

Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.

Is this a configuration issue on the server side? I know that my binding on the WCF service is basictHttpBinding

 

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

BigDubb:

Yes I am hosting the WCF service on an IIS server, not locally


What do you mean by "hosting the WCF on as IIS server, not locally"? You mean your service is running under a remote IIS server?

If yes, could you check your ServiceReferences.ClientConfig and tell us what is the URL for your endpoint to access this service? I assume you already have clientaccesspolicy.xml or crossdomain.xml (you only need one) on the remote server's wwwroot directory.


 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

BigDubb
BigDubb

Member

Member

70 points

82 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Sorry, should have clarified a little better.

 The services is running on a remote server running IIS.

 Here is the client XML in the ServicesReferences.ClientConfig file.

<endpoint address="http://remotewebserver/Services/Service.svc"
                binding="basicHttpBinding" bindingConfiguration="httpBinding"
                contract="AffSolCtrPlayer.DevAffSvc.ISevice" name="httpBinding" />

 

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Do you have clientaccesspolicy.xml on the remote Server's inetpub/wwwroot folder?

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

anil.potta@hotmail.com
anil.pot...

Member

Member

16 points

19 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi

I am kind of new to Silverlight. I am building a tree view control. The data for the tree  need to come from a sharepoint list.

I wrote a web service to get the sharepoint list data. In my silverlight app i added the service ref and tried calling the web method. I get "The remote server returned an unexpected response:(404) Not found." or Access Denied errors.

The web service works fine when i run it alone but gives problem in silverlight app. I copied both the silverlight application and the web service to the server on which the sharepoint site is present. the problem still continues...struggling to make it work from 2 days...any help would be greatly appreciated...

here's my code...

The Web Method to get the sharepoint list data:

[WebMethod]public string GetList()

{

string sURL;

sURL = "http://servername/_vti_bin/owssvr.dll?Cmd=Display&List={1623fa3f%2D43c8%2D4d59%2Da3ab%2Dbb4d89e0962c}&Query=*&XMLDATA=TRUE";

WebRequest wrGETURL;

wrGETURL = WebRequest.Create(sURL);

wrGETURL.PreAuthenticate = true;Stream objStream;

objStream = wrGETURL.GetResponse().GetResponseStream();

StreamReader objReader = new StreamReader(objStream);

string xmlData = objReader.ReadToEnd();return xmlData;

}

 

These are the methods in page.xaml.cs

public Page()

{

InitializeComponent();

client = new Tree.Test.ServiceSoapClient();client.GetListCompleted += new EventHandler<Tree.Test.GetListCompletedEventArgs>(client_GetListCompleted);

client.GetListAsync();

}

void client_GetListCompleted(object sender, Tree.Test.GetListCompletedEventArgs e)

{

string s = e.Result;

}

 This is the clientaccesspolicy file present in the root of the web service

<?xml version="1.0" encoding="utf-8" ?>

<access-policy>

<cross-domain-access>

<policy>

<allow-from http-request-headers="*">

<domain uri="*"/>

</allow-from>

<grant-to>

<resource include-subpaths="true" path="/"/>

</grant-to>

</policy>

</cross-domain-access>

</access-policy>

The web service is present in C:\inetpub\wwwroot folder...so i placed the policy file there...i hope this is the right location... 

 

Thanks in advance

Sri

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

What is the url for endpoint of your service in your ServiceReferences.ClientConfig file? Can you use that URL to access your service by putting that url in a browser?

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

anil.potta@hotmail.com
anil.pot...

Member

Member

16 points

19 Posts

Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi..

I am using a web service...not a web service...

i am able to browse the asmx file and see the web methods as well....

Sri

anil.potta@hotmail.com
anil.pot...

Member

Member

16 points

19 Posts

Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

sorry for the typo...

I am using a web serivice not a WCF service... Smile

Sri

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 It does not matter if it's an asmx service or WCF service, you can still add ServiceReference. What type of object your service returns?

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

BigDubb
BigDubb

Member

Member

70 points

82 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Yes, I have a clientaccesspolicy.xml file in the root of the web server.

I am still struggling with this. It seams the ONLY way one can create reference to a service in a silverlight application is to do the following.

  1. Create a Silverilght Solution
  2. Add a WCF-Enabled Service to the Web site created as a part of that solution
  3. Add a Service Reference in the Silverlight Project to the newly created WCF Service on the Web Solution

I have been struggling for a couple of weeks on trying to get a silverlight application to work on an existing web site. If I follow the above listed sequence of events I can get the project to build and access data etc, no problems.  However If I try to add a Siverlight Project to an existing solution, then add a WCF Enabled Service to the Web Project I get an error.  The SVC file is working and accessible, from a URL, the WSDL is accessible, the SVC file is accessible via console project. When attempting to add a Service reference to a Silverlight project I get

Service1.svc was not recognized as a known document type.

I have checked the web.config file for the web project, and all looks as expected.  Fully qualified namespace in the config files. url in the name spaces.

I Turned on WCF Tracing and am getting this error.

Content Type application/soap+xml; charset=utf-8 was sent to a service expecting text/xml; charset=utf-8.  The client and service bindings may be mismatched.

I checked the config files... and all is good. 

One thing I noticed in the WSDL was that it was referencing my local maching in the WSDL, would this be contributing to this issue? How do I tell the automatically generated WSDL to use localhost vs. my localmachine.

 What am I missing???  

 

 

 

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

If you are trying to use an exsting service that outside your solution, just add the Service Reference point to that service. Do not use Discover button which scan through your solution to find the service. Just type the URL in the URL box.

You need to make sure your existing asmx service has this tag line: [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)], Because currently Silverlight can only access service that has basicHTTPBinding. 

Also make sure the Web.Config under your Service site has the following entry:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />   

   ...

</system.serviceModel>

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

anil.potta@hotmail.com
anil.pot...

Member

Member

16 points

19 Posts

Re: Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi sladapter,

Thanks for the reply..

My webmethod returns the sharepoint list data...i tried callinf the basic Hello World web method...thats also not working in my case..

I used web development helper to find out the error. It shows

http://localhost:4905/clientaccesspolicy.xml 404...

I already have the clientaccesspolicy file in wwwroot folder...

If i browse the above link(http://localhost:4905/clientaccesspolicy.xml) in IE..i get the page cannot be displayed error...

Inorder to make the xml file avalable at that port i created a website in IIS with the same port i.e 4905...in that case i am able to browse the above xml but the asmx doesn't browse saying that the port is already in use...I am sure that i am missing a basic thing here ...any thoughts on this

Sri

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Why do you need to put a port number? If your Service is running under IIS, just use http://localhost/YourServiceWeb/YourService.asmx to access it. That port number is used by your DevServer, not IIS server.

Make sure your Service is under a Web site not on the wwwroot. 

 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

anil.potta@hotmail.com
anil.pot...

Member

Member

16 points

19 Posts

Re: Re: Re: Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

Hi

Thanks for the reply...I avoided using my custom service and used the sharepoint web service...it worked Smile...

Thanks once again...

Sri

MaxxedMan
MaxxedMan

Member

Member

2 points

1 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

This post works 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><Breeder_CreateOrGetBreeder><facebookId>0</facebookId><name>Name</name></Breeder_CreateOrGetBreeder></s:Body></s:Envelope>

This post gives me 404 Cross domain problems

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><Breeder_CreateOrGetBreeder><facebookId>500229149</facebookId><name>Name</name></Breeder_CreateOrGetBreeder></s:Body></s:Envelope>

 It is a facebook silverlight app, but the iframe is pointing to my localhost...  any idea why changing the variable would trigger a cross domain issue?

sladapter
sladapter

All-Star

All-Star

18016 points

3,321 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

MaxxedMan:
 

It is a facebook silverlight app, but the iframe is pointing to my localhost...  any idea why changing the variable would trigger a cross domain issue?

 

How do you know it's a cross-domain issue?  Not all 404 error results form cross-domain issue. It could be internal service error when you use different ID (like invalid ID?).

Read my post in the following thread for more cases could result 404 error:

http://silverlight.net/forums/p/24005/86700.aspx#86700

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Anatoly_Lozovoi
Anatoly_...

Member

Member

2 points

1 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

 Yi-Lun Luo, Thanks a lot! Your posts are always very helpful! As it has turned access to db was denied for network account. And i charge WCF. Logs file dave me.

mahendra.gurav
mahendra...

Member

Member

146 points

166 Posts

Re: Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

hi,

im having problem when endpoint adress is ip address in ServiceReferences.ClientConfig,

and woeks fine when en point address as mycomputer name.

 

What should I do?

Thanks

Mahendra

moemeka
moemeka

Member

Member

147 points

69 Posts

Re: Silverlight and WCF Web Service, HTTP 404, Beta 2

enantiomer2000:

 @moemeka

 There seems to be some important differences between the Silverlight and full .Net framework versions of System.Serialization.Runtime and System.ServiceModel.  For one thing, ChannelFactory has different CreateChannel signatures.  I tried doing what you suggest but it kept giving me problems with conflicting assemblies.  It seems like I will probably have to reference the Silverlight versions in all my projects (the wcf interface project and the business entity project) because the silverlight project can ONLY reference the silverlight types, but I keep getting issues with this.

 When it comes down to is, all i really care about is when I call my service, I get my actual business object back...

did you get an answer for this?  This post has so many entries I turned off email notification and lost track of your question.  You can use [Add As Link] to add a shortcut to the types you want shared between both silverlight and the main.net (in this case ur data contracts and interfaces.  To use the standard method of calling ur wcf services without any code geenration just create an interface with AsyncPattern=true.  For this to work Action and Replyaction must be set to the url of your service (http://tempuri.org/<service class name>/<method name>) and (http://tempuri.org/<service class name>/<method name>Response) respectively.  Now you can just call the Begin operation and pass in a waitcallback delegate which will be called when the call ends.  In there you call End operation (passing in the async result) and your done.  As per the WCF async pattern remember that the Interface must have a Begin<op> and End<op>. The End<op>  must not specify operation contract.

I found this to be very usefull in many scenarios.  For one thing, this approach does not require every single method of the wcs service to be imported.  It also does not create any new types.  Hope this helps . 

Please mark as answered if this post resolves your issue.

http://moemeka.blogspot.com
  • Unanswered Question
  • Answered Question
  • Announcement