在调用Web服务时,我收到以下错误:
HTTP请求未经授权使用客户端身份验证方案"NTLM".从服务器收到的身份验证标头是"NTLM".HTTP请求未经授权使用客户端身份验证方案"NTLM".从服务器收到的身份验证标头是"NTLM".
我有一个Silverlight 4应用程序,它在我的IIS(7)上调用WCF Web服务.我的WCF Web服务使用NTLM(Windows身份验证)调用安装在不同Web服务器上的另一个ASMX Web服务.我的服务器和托管ASMX Web服务的服务器都位于同一个域中.
当Silverlight客户端从服务器打开应用程序时,http://localhost/MySiteName一切正常.但是当Silverlight客户端从不同的客户端(不是服务器但仍在同一个域中)打开应用程序时,使用http://MyServerName/MySiteName然后我得到错误.
我的IIS中启用了Windows身份验证.我的IIS中禁用了匿名身份验证.
用于调用我的WCF Web服务的绑定配置是:
<binding name="winAuthBasicHttpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
Run Code Online (Sandbox Code Playgroud)
用于调用ASMX Web服务的绑定配置是:
<binding name="ClNtlmBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
Run Code Online (Sandbox Code Playgroud) 我在VS2010中创建了一个新的silverlight 4项目.
我的App.xaml文件如下:
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ZCall.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles.xaml"/>
<ResourceDictionary Source="Resources/ObjectResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)
生成错误的示例xaml视图是:
<UserControl x:Class="ZCall.View.Control.CDetailsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:BusyIndicator x:Name="biCDetails" BusyContent="Busy...">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="170"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Orientation="Horizontal">
<TextBlock Text="Name:" Style="{StaticResource PatientLabel}"/>
<TextBlock x:Name="txtName" Style="{StaticResource PatientData}"/>
</StackPanel>
</Grid>
</toolkit:BusyIndicator>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
我在PatientLabel和PatientData资源上都得到了错误.
我的style.xaml文件位于项目根目录的Resources文件夹中.
我的问题是,在设计时,我没有识别styles.xaml中定义的样式,并且我为每个使用的样式都收到错误"资源无法解析",而在运行时,所有样式都被解析并显示为它应该是.
有什么建议? …