|
|
Whenever I call my SSL enabled webservice I get this message:
An error occurred while trying to make a request to URI 'https://XXXX.com/XXXX.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
This service works with no crossdomain issues without SSL. I followed some online guide to enable SSL, which is to add a few lines in crossdomain policy file:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Changing the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SSLEnabled" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="XXXX.Web.XXXX">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="XXXX.Web.XXXXBehavior" name="XXXX.Web.XXXX">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="SSLEnabled" contract="XXXX.Web.XXXX" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
The host I am working on has multiple domain name so I had to add the following code in the WCF service:
Public Class XXXXHostFactory
Inherits ServiceHostFactory
Public Overrides Function CreateServiceHost(ByVal constructorString As String, ByVal baseAddresses() As System.Uri) As System.ServiceModel.ServiceHostBase
Return MyBase.CreateServiceHost(constructorString, baseAddresses)
End Function
Protected Overrides Function CreateServiceHost(ByVal serviceType As System.Type, ByVal baseAddresses() As System.Uri) As System.ServiceModel.ServiceHost
Dim webServiceAddress = New Uri("https://XXXX.com/XXXX.svc")
Dim webServiceHost = New MyServiceHost(serviceType, webServiceAddress)
Return webServiceHost
End Function
Public Class MyServiceHost
Inherits ServiceHost
Public Sub New(ByVal serviceType As Type, ByVal baseAddresses As Uri)
Dim BaseAddressScheme As New UriSchemeKeyedCollection
BaseAddressScheme.Add(baseAddresses)
MyBase.InitializeDescription(serviceType, BaseAddressScheme)
End Sub
Protected Overrides Sub ApplyConfiguration()
MyBase.ApplyConfiguration()
End Sub
Protected Overrides Sub InitializeRuntime()
MyBase.InitializeRuntime()
End Sub
End Class
End Class
And change the markup of the WCF to:
<%@ ServiceHost Language="VB" Debug="true" Service="XXXX.Web.XXXX" Factory="XXXX.Web.XXXXHostFactory" CodeBehind="XXXX.svc.vb" %>
Everything works perfect without SSL, but I added another service for authentication - which requires SSL and made the changes to the code shown above, and I get the crossdomain error.
What else did I miss?
|
|
|
|
|
Hi there,
I was getting the same message with an SSL enabled service recently. It turned out that the name on the certificate in IIS was slightly different than what I had in the WCF binding (I was missing a "companyname.co.nz" on my binding). It didn't really matter without SSL because it was all running locally so the machine-name (without the "companyname.co.nz") was enough.
Something for you to double check anyway.
Cheers.
|
|
|
|
|
Thank you, it turns out everything was set up fine, but the Certificate itself was wrong. The host has fixed it and now the SSL service work fine.
|
|
|
|
|
Also, if you're hosting on IIS, make sure there's an HTTPS binding on the site.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
OK, here is the scenario. Take a selector (any type of list item that you can select values) and bind it to an observable collection. Let's say that collection is populated from a service call.
The issue is that you bind, the collection is empty, so there is no selected index. You cannot plug into the Loaded event on the box because if you try to set selectedindex = 0, and the collection hasn't loaded yet, you're out of luck.
In the code behind I can wire into the collectionchanged and then set selectedindex = 0 but that seems a little contrived.
I have a full solution using attached properties but it seems overly complicated for the behavior (I want to always default to the first item in a collection when the collection becomes available).
Anyone have a similiar scenario and thoughts about a solution?
One thing I looked at was having the view model raise a "collection loaded" event, but then again the view will have to hook into that in the code behind.
My attached properties solution basically creates a list of weak references between the selectors and the collections, then hooks into the collection changed event. When it fires, it finds the selector it is linked to and then sets the selected index. It works like a charm but I want to make sure I'm not overcomplicating it when there may be some setting that says, "Default to the first item" when a collection gets filled.
Thanks,
Jeremy
|
|
|
|
|
Hi Jeremy,
One way could be to have a property in the ViewModel like this:
private int _selectedIndex = -1;
public int SelectedIndex
{
get { return _selectedIndex; }
set
{
if (value != _selectedIndex)
{
_selectedIndex = value;
NotifyPropertyChanged("SelectedIndex");
}
}
}
It's set to -1 initially so the XAML doesn't throw an error when there's no collection to bind to.
Bind it to the list box:
<ListBox ItemsSource="{Binding Employees}" SelectedIndex="{Binding SelectedIndex}" />
Then, in the completed event (when the service returns from the asynchronous call with the data) you can set it to whatever you want.
void svcClient_GetDataCompleted(object sender, EmployeeSvc.GetDataCompletedEventArgs e)
{
Employees = e.Result;
SelectedIndex = 1;
}
Not particularly elegant, but it seems to work.
Cheers.
|
|
|
|
|
My data has many columns but a few rows. I need to “rotate” the display with the DataGrid. I wish the DataGrid could display rows as columns, and columns as rows. Is it possible?
|
|
|
|
|
I don't think the datagrid does any transposing at the moment.
This[^] blog post shows a way of transposing your data instead.
Hope that helps.
|
|
|
|
|
hi friends,
i am using a datagrid for my application, i have a combos box in which i am populating data frm a class ie i am using cellEditingTemplate <combobox itemsource="{Binding" theclassname.listused}="" selecteditem="ListUseddataId"> etc i am not able to populate data in the combobox.. how can i debug a combodox data if it is used as data template?
Thanks in Advance...
Regards
Samir
|
|
|
|
|
VCsamir wrote: i am not able to populate data in the combobox
How are you trying to populate the combobox?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I m working on a windows project . i m new in WPF. so my question is can we use wpf controls and graphics in my existing windows project....tell me sum link for tutorial to if this is possible
|
|
|
|
|
Do you mean that you want to host WPF controls inside a WinForms application? Why not write the whole application in WPF?
If you do mean hosting inside WinForms, you might want to follow the tutorial here[^].
"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 dont want to change the whole application. I want to apply WPF graphics on some of my pages.
IS its possible???????????
|
|
|
|
|
You can probably embed a WPF window here and there, but I think it's a dumb idea. You'd do better to start with WPF, embed your winforms controls as needed, and do the rest with WPF.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
anuj1784 wrote: IS its possible???????????
Did you even look at the link I included in my post?
"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
|
|
|
|
|
ohh sorry i thought u not understand wat i m tring to say
|
|
|
|
|
Hi,
I am developing a wpf application, with which I need to develop a user control,
but for now I am trying to achieve that functinality on one of my WPF forms first.
All I needed is picture(thumbnail size) list on the left side(vertically) of the form, and should able to manually scroll though the list
I am using Grid -> button(UP) in first row, button(DOWN) in third row ->
scroll viewer in middle row -> listbox(within the scroll viewer) -> individul images in the listbox
My main goal is to animate the imagelist vertically on clicking up or down button accordingly,
Now I almost got this simple functionality by setting scrollviewer's contentverticaloffset property,
but it's not smooth, it does not animate but just move up and down. Is there anyway I can animate this list smoothly?
I hope the problem makes sense, I am kind of new to WPF.
Thanks
|
|
|
|
|
grvdarji wrote: listbox(within the scroll viewer)
A listbox by default already has a scrollviewer wrapping its items presenter.
Do you just need to scroll through the images or do you also
need to be able to select images?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the reply, Mark
Actually, the moment I clik on any image in listbox, the big image of the same, should show up in right hand side big image control.
So in order to answer your que.
No it is not just scrolling but I should be able to select and use that image-ID as well.(So it has to be a button at the top and bottom of listbox for manual scrolling since I don't want default scrolling, also I should not click(pick) and move image for scrolling.)
Just FYI: the thumbnail and big image are diff. image and coming from MS access 2007 DB.
Sorry for less info. in first time.
|
|
|
|
|
There's lots of ways to accomplish this.
If you want to use a ListBox, you could
1) remove your scrollviewer to use the one in the listbox
2) re-template the listbox as show in the sample code here:
ItemsControl.ItemsPanel Property[^]
setting the scrollviewers scrollbarvisibility properties to Hidden
3) At runtime, find the listbox's scrollviewer so you can manipulate it
programmatically, as shown here: Access ScrollViewer from within a style[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for letting me understand the tree structure of the controls in WPF.
the posts you have directed to, are surely helpful.
I tried the same tree structure, and code.
(Correct me if I am wrong but, the code I have seen also had scrollviewer inside the border control, I also tried removing scrollviewer(to use listbox's default) as you said earlier but it stopped scrolling, then I put it back as the code sujjested and as per my previous working Markups)
Now, the main thing is that, after trying it, All I could get is step by step scrolling which I was getting before too.
I intend to get smooth scrolling, just like you hold scroll bar and move little up/down, but on click of my up/Down buttons.
thanks for the reply, it cleared my other doubts though.
|
|
|
|
|
Hi
I recently did some digging on the internet and I found a way to use the Vista Aero theme in Windows XP. One can simply add the following line of code to the App.xaml file:
<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml"/>
Now my question is, how can I specify this line of code when I already have other styles etc. specified in the App.xaml file? It gives me an error saying "Cannot add element to property 'Resources', because the property can have only one child element if it uses an explicit collection tag". It works when I remove everything else from App.xaml though.
|
|
|
|
|
You need to use a merged dictionary. Here's one from one I'm working on right now:
<Application
x:Class="Goldlight.SampleApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/BureauBlue/Theme.xaml"/>
<ResourceDictionary Source="Goldlight.Resources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
"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
|
|
|
|
|
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="...aero etc etc..."/>
<ResourceDictionary Source="...your dictionary..."/>
<ResourceDictionary Source="...and many more..."/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
EDIT: Ah well, Pete beat me to it.
|
|
|
|