|
Hi,
When I am trying to access the RSS feeds from silver light I am getting System.Security. Security Exception. For resolving this I places crossdomail.xml and clientaccess.xml files in my application and tries. But they didn’t worked and I am getting the same error for some websites.
If anyone have any idea how to use them or place them in an Silverlight application please reply me. Please reply me soon. Its urgent.
Thanks in advance.
|
|
|
|
|
If you are accessing the feed which is outside of your website then crossdomain.xml and clientaccesspolicy.xml should be hosted on that sites.
For example:
Your Silverlight website is http://mycoolsilverlight.com and the feed that you are accessing is http://anotherwebsite.com. So, you should be able to access
http://anotherwebsite.com/crossdomain.xml or http://anotherwebsites.com/clientaccesspolicy.xml
Hope it helps.
|
|
|
|
|
I have a lot of Services running.
And all of them are written in sync way.There is no async operation pattern at all.
Silverlight 3.0 client is one of many clients for this services.
All other clients work pretty well with sync operations.
I have to generate SL proxy for this services.
I do not want to use AddServiceReference.
I want to use ChannelFactory to create proxy.
When i write ChannelFactory<IServiceRegistrar> cf = new ChannelFactory<IServiceRegistrar>(new BasicHttpBinding(),
new EndpointAddress("http://localhost:5545/Registry"));
i have exception saying that IServiceRegistrar contract does not support async pattern.
How can i create proxy for sync wcf service contract manually in SL?
|
|
|
|
|
pioner wrote: all of them are written in sync way
What do you mean by "all of them are written in sync way"? what is "sync way" in writing the web services?
Having sync or async method is totally depend on how you generate the proxy class.
All versions of Silverlight don't support "Sync" calls because Microsoft doesn't want the browser to be freezed. So, all calls to Web services must be "async" calls.
Hope it helps.
|
|
|
|
|
pioner wrote: How can i create proxy for sync wcf service contract manually in SL?
It doesn't matter if the service operation is implemented sync or async on the server.
Silverlight is on the client end independent of the server, and service operations
MUST be implemented async in Silverlight. That means specifying AsyncPattern=true
on your OperationContractAttributes and implementing your interface methods with the
BeginOperation/EndOperation pattern.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: That means specifying AsyncPattern=true
on your OperationContractAttributes
It's not really necessary to apply this attribute in OperationContractAttributes. You can just tick "async" when you are generating proxy.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Michael Sync wrote: You can just tick "async" when you are generating proxy.
Right. The OP specified "How can i create proxy for sync wcf service contract
manually in SL?" so I assumed (s)he was doing it manually.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, Mark.
If I remember correctly, SVCUtil.exe can't be used for generating the proxy class for Silverlight from command-line. It wasn't supported until Silverlight 2 release. (but there are some workarounds like that "link[^]" )
I will check whether we can generate the proxy class for Silverlgiht from commandline in Silverlight 3 or not.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Yes. Generating the proxy from commandline using SlSvcUtil.exe is supported in Silverlight 3 C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Tools.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I meant I assumed the OP was hand-writing the service proxy code
I appreciate the info though!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: It doesn't matter if the service operation is implemented sync or async on the server.
Silverlight is on the client end independent of the server, and service operations
MUST be implemented async in Silverlight. That means specifying AsyncPattern=true
on your OperationContractAttributes and implementing your interface methods with the
BeginOperation/EndOperation pattern
implementing your interface methods with the
BeginOperation/EndOperation pattern
What interface??? I have only one interface on server side.It marked with ServiceContract attribute.
No more interfaces except generated by svcutil(if i use it)
And that serverside interface and it`s implementation=wcf service,it doesn`t contain ANY async pattern methods.
When i write wcf service i don`t want to think "Oh my client will be sl application,then i need async pattern for my methods".
So how can i generate proxy for such a contract without using svcutil.
It`s not possible to use ChannelFactory because it creates sl proxy only for service contracts with async pattern methods.
|
|
|
|
|
Is there any reason why you don't want to use svcutil or "Service Reference"?
We have a lot of WCF services that are consumed by WPF, Silverlight and ASP.NET 3.5 in our project. We don't implement any BeginOperation or EndOperation or any sync or async pattern.
The "async" option is ticked by default when we are generating the proxy for Silverlight so we can use the code like service.GetDataAsync() and service.GetDataCompleted automatically.
But we don't tick "async" option when we are generating the proxy for WPF and ASP.NET so we can use service.GetData(); ...
I would like to know more details about why you don't want to use "Service Reference" or svctil utility.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Michael Sync wrote:
I would like to know more details about why you don't want to use "Service Reference" or svctil utility
We have some kind of repository of wcfs.And it dynamically adds and removes wcfs.
So client can ask repository for service proxy knowing only service contract.And repository should generate proxy manually.
Repository will generate proxy with sync methods for all clients except silverlight and should generate proxy for silverlight with async methods.But because all is dynamic we cant use Add Service Reference.
|
|
|
|
|
I am doing most of my WCF services "near" sync in Silverlight 3 based on this article Synchronous Web Service Calls with Silverlight 2: Dispelling the async-only myth[^].
Basically I add the service reference as per normal, then generate the channel factory as below:
ThreadPool.QueueUserWorkItem(delegate
{
var channelFactory = new ChannelFactory<IDataService>("*");
var dataService = channelFactory.CreateChannel();
var asyncResult = dataService.BeginSaveMethod(dataObject, null, null);
newInfonMachineActiveDefinition.Id = dataService.EndSaveMethod(asyncResult);
if (Dispatcher.CheckAccess())
{
Visibility = Visibility.Collapsed;
}
else
Dispatcher.BeginInvoke(delegate
{
Visibility = Visibility.Collapsed;
});
});
NOTE: I have not shown any exception handling here to keep the code simpler
It is important that you call the Dispatcher from the same thread that is executing the "sync" call else your UI is not going to wait for the call to finish...
This approach has one major downside, the call must be done form code behind of the control and not from a proxy class in your client, but you can try to refactor it to pass a delegate to your proxy class that will be called from the Dispatcher, or something like that...
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
use syncwcf library from codeplex: http://syncwcf.codeplex.com it doees exactly what you need: allows to use the sync-style service interface without writing nor generating code for them
|
|
|
|
|
Hi all,
I have a simple listview that has a currently selected item binding as follow:
<ListView HorizontalAlignment="Left" Width="300" Name="ServiceListView" SelectionChanged="ServiceListView_SelectionChanged" SelectedValue="{Binding CurrentlySelectedService}" Grid.Row="0" Grid.RowSpan="2" Grid.Column="0">
<ListView.View>
<GridView>
<GridViewColumn Header="Machine">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label x:Name="ServiceNames" Content="{Binding ServiceController.MachineName}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Service Names">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label x:Name="ServiceNames" Content="{Binding ServiceController.ServiceName}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Service status">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Width="80" x:Name="ServiceStatus" Content="{Binding ServiceController.CurrentStatus}" Background="{Binding ServiceController.ServiceStatusColour}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
And obviously in the constructor I do the following to enable bindings:
DataContext = this;
The problem:
The binding to SelectedValue="{Binding CurrentlySelectedService}" works 100% (well, sort of).
In my DEV environment it works 100% and the currently selected item works 100%.
But for some or other reason when I deploy this to a Windows server 2003 box (with .Net 3.5 installed), the binding doesn't work anymore...
How can I debug this issue?
Has anyone experienced this problem before?
This is not my first time experiencing this problem. I've seen this a few times now, but it seems to be very PC specific. It will work 100% on one pc, and then completely FAILS on another.
Any help would be much appreciated.
|
|
|
|
|
You need Snoop[^] - run it on the target machine, and see what your listview thinks the DataContext is.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Got snoop ... didn't think of using it.
Why the DataContext ? If the DataContext is not the correct one, how does one go about setting the correct one ...?
|
|
|
|
|
The reason I suggested this, is that it sounds like the DataContext is behaving differently between the two machines. Snoop can be used to help you determine if this is the case.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i have thousands of data to be bound in the combobox. it takes minutes to display the popup while clicking the combo. i have heared about the virtualisation. but how it could be applied to the ComboBox.
|
|
|
|
|
I would say that thousands of data should not be binded to the combobox. It will make the combobox very ugly and very slow to load. You should probably use another control (e.g. datagrid or listbox with paging.)
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I'd have to agree there. It's one thing to get them in the drop down, but then the user will have to select them. This sounds more like a pattern for doing a look ahead box or something similar (a text box that as you type, begins to build a partial drop down based on the text you've already entered).
If you had to do it for some reason, the key would be:
1. Use an ObservableCollection<t> when you bind to the list. This will make the control aware when the list changes.
2. Append to the list over time
That's more tricky - the async calls of course fire when done so you have the entire list and you'd still be waiting. Better would be to find a way to chunk up your calls, i.e. perhaps call alphabetically and bring back everything beginning with A, then B, etc. Then append to the list. This will make the drop down appear sooner and it will grow dynamically, but the question then becomes - is this even useful, if the user still has to wait a minute for a full drop down?
|
|
|
|
|
Hi,
I am working on RSS feeds using silver light. In this I need to access each item(feed) from the RSS feeds link and display it in my silver light application. I implemented a code for this but by this I am able to access only some RSS feeds only. It is not working for all the RSS links. I am getting error while accessing the feed items from RSS feeds.
Please reply me if anyone have any idea how I can make it work for all the RSS links and solve this error while accessing.
The code I have used is from:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=252
Thanks in advance.
|
|
|
|
|
|