Thus you should put your cross domain policy file under the root of your web service project.
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.
I cannot download your *.rar file due to my company policy. If your service is located at
http://localhost:8082/WebSite1/Modules.svc, than the SVL page should be located there as well, e.g.
http://localhost:8082/WebSite1/TestPage.html if you don't put the cross domain config under WebSite1/
Well, looks like the ASP.NET test server maps the root folder to
http://localhost:8082/WebSite1. Thus the policy file is placed under
http://localhost:8082/WebSite1. This will not work. Sorry I can't figure out how to make ASP.NET test server to map the root folder to
http://localhost:8082. Can you use IIS instead? After I deployed your service to my IIS, and add the policy file to wwwroot folder, I've successfully called the service. Also note you must run your Silverlight application
from http protocol. When creating a new Silverlight project, make sure to choose add a new web site. If you choose to just create a dynamic test page, your application will run from the file system.
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.
I am having the same problem, and tried to follow this thread to solve it. Not successful. My service is located at: C:\Dev\SilverlightApplication1\WcfService1\service1.svc with URL as
http://localhost/WcfService1/service1.svc. My IIS default web site is:
http://localhost/, and it's mapped to C:\Inetpub\wwwroot. I created a policy file at: C:\Inetpub\wwwroot. And it can be accessed by
http://localhost/crossdomain.xml as instructed by the Microsoft document. My SL client is running by WebDev.WebServer with a dynamic port, which is not my choice. It's created like that even when I selected web
site option. Things just don't work. I get CrossDomainError every time.
I also have been following this thread and still cannot call my web service from my SL2 Beta 1 app. I have a WCF service on a live server.
I've changed the binding in web.config to basicHttpBinding and went into IIS and created a new "Application" on the server for the folder my service resides in. I also added crossdomain.xml and clientaccesspolicy.xml to both the root of my site and the webservice's
folder. And in case you're wondering, the .svc URL loads fine in a browser (no errors).
In my SL2 project I've added a service reference via the live url. It appeared to add fine.
In my code I call:
Dim WithEvents ServerObject As New Server_Samples.ServicesClient(New System.ServiceModel.BasicHttpBinding,
New System.ServiceModel.EndpointAddress(New Uri("http://mylivesite.com/Service1/Services.svc")))
ServerObject.MyFunctionAsync(Param1,
Param2) ' this bombs out inside my proxy class's BeginMyFunction method
An exception of type 'System.ServiceModel.CommunicationException' occurred in System.ServiceModel.dll but was not handled in user code
coder21
Member
132 Points
46 Posts
Re: Re: calling wcf service problems
Mar 11, 2008 08:34 AM | LINK
the port number is set to 8082 and Use dynamic ports is set to false. it is not hosted in IIS. it is filesystem based
Yi-Lun Luo -...
All-Star
25149 Points
2759 Posts
Microsoft
Re: Re: calling wcf service problems
Mar 11, 2008 08:47 AM | LINK
Thus you should put your cross domain policy file under the root of your web service project.
coder21
Member
132 Points
46 Posts
Re: Re: calling wcf service problems
Mar 11, 2008 09:07 AM | LINK
Here is a link to the project
http://cid-71b364b59919d1e8.skydrive.live.com/self.aspx/docs/Example2.rar
Can you tell me what I am doing wrong
dhnhuy
Member
40 Points
17 Posts
Re: Re: Re: calling wcf service problems
Mar 11, 2008 10:21 AM | LINK
I cannot download your *.rar file due to my company policy. If your service is located at http://localhost:8082/WebSite1/Modules.svc, than the SVL page should be located there as well, e.g. http://localhost:8082/WebSite1/TestPage.html if you don't put the cross domain config under WebSite1/
HTH
Yi-Lun Luo -...
All-Star
25149 Points
2759 Posts
Microsoft
Re: Re: calling wcf service problems
Mar 11, 2008 10:33 AM | LINK
Well, looks like the ASP.NET test server maps the root folder to http://localhost:8082/WebSite1. Thus the policy file is placed under http://localhost:8082/WebSite1. This will not work. Sorry I can't figure out how to make ASP.NET test server to map the root folder to http://localhost:8082. Can you use IIS instead? After I deployed your service to my IIS, and add the policy file to wwwroot folder, I've successfully called the service. Also note you must run your Silverlight application from http protocol. When creating a new Silverlight project, make sure to choose add a new web site. If you choose to just create a dynamic test page, your application will run from the file system.
johnxjcheng
Member
18 Points
11 Posts
Re: Re: calling wcf service problems
Mar 12, 2008 10:30 PM | LINK
I am having the same problem, and tried to follow this thread to solve it. Not successful. My service is located at: C:\Dev\SilverlightApplication1\WcfService1\service1.svc with URL as http://localhost/WcfService1/service1.svc. My IIS default web site is: http://localhost/, and it's mapped to C:\Inetpub\wwwroot. I created a policy file at: C:\Inetpub\wwwroot. And it can be accessed by http://localhost/crossdomain.xml as instructed by the Microsoft document. My SL client is running by WebDev.WebServer with a dynamic port, which is not my choice. It's created like that even when I selected web site option. Things just don't work. I get CrossDomainError every time.
Timmy G
Member
231 Points
100 Posts
Re: Re: calling wcf service problems
Mar 12, 2008 11:12 PM | LINK
I also have been following this thread and still cannot call my web service from my SL2 Beta 1 app. I have a WCF service on a live server.
I've changed the binding in web.config to basicHttpBinding and went into IIS and created a new "Application" on the server for the folder my service resides in. I also added crossdomain.xml and clientaccesspolicy.xml to both the root of my site and the webservice's folder. And in case you're wondering, the .svc URL loads fine in a browser (no errors).
In my SL2 project I've added a service reference via the live url. It appeared to add fine.
In my code I call:
Dim WithEvents ServerObject As New Server_Samples.ServicesClient(New System.ServiceModel.BasicHttpBinding, New System.ServiceModel.EndpointAddress(New Uri("http://mylivesite.com/Service1/Services.svc")))ServerObject.MyFunctionAsync(Param1,
Param2) ' this bombs out inside my proxy class's BeginMyFunction methodAn exception of type 'System.ServiceModel.CommunicationException' occurred in System.ServiceModel.dll but was not handled in user code
Additional information: [CrossDomainError]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.ServiceModel.dll&Key=CrossDomainError
Any help would be greatly appreciated! I've been trying everything I can think of for the majority of the day and still can't get it to work.
fyi: I also tried to hit this exact same service from a WinForms app and it worked fine.
yourbuddypal
Member
198 Points
85 Posts
Re: Re: calling wcf service problems
Mar 13, 2008 01:22 AM | LINK
I am having the exact same error. This seems to be a widespread thing?
Radiox
Member
150 Points
49 Posts
Re: Re: calling wcf service problems
Mar 13, 2008 03:00 AM | LINK
I can run my app in the VS2008 testing server and it works ok in IIS.
However, is not working when accessed from a remote machine.
I have the crossdomain file and the ports are open for web.
I must have something missin'
Radiox
Member
150 Points
49 Posts
calling wcf service problems
Mar 13, 2008 11:36 PM | LINK
The webservice was not properly setup on the Silverlight app.
I could not find an easy way to fix than to open the Web Service References folder and scan and change every file for the webservice's url.
I didn't work when:
trying to remove the service and readd it using the public ip address.(previously using the local machine name)