我在启用Silverlight的WCF上请求帮助。
在Silverlight中实现WCF时出现以下错误。
"An error occurred while trying to make a request to URI 'http://localhost:4496/PROJECT/Service.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"
我正在使用Silver Enabled WCF模板。
当用Fiddler检查时,发现显示404 ERROR 1.clientaccesspolicy.xml 2.crossdomain.xml
Clientaccesspolicy.xml包含以下内容:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Crossdomain.xml包含以下内容:
<?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="SOAPAction,Content-Type"/>
</cross-domain-policy>
请帮我解决问题。
答案 0 :(得分:0)
zafar感谢您的回复。
我没有在.web项目中添加.xml文件,而是将它们添加到银光应用程序中。为解决目前的问题。
还有一个问题:
每次重新启动计算机时,我都会收到来自服务
的奇怪错误Could not load file or assembly App_Web_yadayadayada
&#34; yadayadayada&#34;是每次通过visual studio运行Web应用程序时创建的程序集文件。
为此,Here
有一个解决方案将以下属性添加到web.config
<compilation debug=”false” batch=”false”>
目前它正在发挥作用。
第二个问题是
请帮我解决这个问题。
Silverlight的设计部分仅在Chrome浏览器中可见,在IE中一半可见,在Firefox中不可见。请帮忙。
Design main.xaml在下面提供:
<UserControl x:Class="My_silverlight.MainPage"
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"
mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="1000" ScrollViewer.VerticalScrollBarVisibility="Auto" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
<toolkit:BusyIndicator HorizontalAlignment="Center" VerticalAlignment="Center"
Name="busyIndicator" IsBusy="{Binding IsBusy}" >
<Grid x:Name="layoutRoot" ShowGridLines="True" Height="900" Width="950" Background="Orange">
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="121*" />
</Grid.RowDefinitions>
<TextBlock Text="PROJECT" FontFamily="Verdana" FontSize="14" FontWeight="Bold" Foreground="White"
Grid.RowSpan="2"></TextBlock>
<Grid ShowGridLines="False" Background="White" Margin="0,27,0,7" Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250" />
<ColumnDefinition Width="256*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="255" />
<RowDefinition Height="205" />
<RowDefinition Height="30" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<TextBlock Text="Name of the Pilgrim :" FontFamily="Verdana" Grid.Row="2" Grid.Column="0" FontSize="14" FontWeight="Bold" Foreground="Green" Margin="4,10,-14,4" ></TextBlock>
<TextBlock Text="About Me :" FontFamily="Verdana" Grid.Row="3" Grid.Column="0" FontSize="14" FontWeight="Bold" Foreground="Green" Margin="4,10,-14,4" ></TextBlock>
<!--<TextBlock Text="Country :" FontFamily="Verdana" Grid.Row="4" Grid.Column="0" FontSize="14" FontWeight="Bold" Foreground="Green" Margin="4,10,-14,4" ></TextBlock>-->
<TextBox Text="K" FontFamily="Verdana" Grid.Row="2" Grid.Column="1" FontSize="14" FontWeight="Bold" Foreground="Green" Height="30" ></TextBox>
<TextBox Text="SharePoint Developer" FontFamily="Verdana" Grid.Row="3" Grid.Column="1" FontSize="14" FontWeight="Bold" Foreground="Green" Height="30" ></TextBox>
<!--<TextBox Text="India" FontFamily="Verdana" Grid.Row="4" Grid.Column="1" FontSize="14" FontWeight="Bold" Foreground="Green" Height="30" ></TextBox>-->
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0" >
<StackPanel Orientation="Horizontal">
<Button Content="start" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
<Button Content="capture" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Button2" VerticalAlignment="Top" Width="75" />
</StackPanel>
<Rectangle x:Name="rectWebCamView" Width="200" Height="200" Margin="5" VerticalAlignment="Top" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1" >
<Image Height="170" Name="image1" Stretch="Fill" Width="150" HorizontalAlignment="Left" Margin="22,50,0,30" />
<Image Height="170" Name="image2" Stretch="Fill" Width="150" HorizontalAlignment="Left" Margin="22,50,0,30" />
<Image Height="170" Name="image3" Stretch="Fill" Width="150" HorizontalAlignment="Left" Margin="22,50,0,30" />
<Image Height="170" Name="image4" Stretch="Fill" Width="150" HorizontalAlignment="Left" Margin="22,50,0,30" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" >
<Image Height="170" Name="image5" Stretch="Fill" Width="150" HorizontalAlignment="Left" Margin="0,0,50,0" />
<Image Height="170" Name="image6" Stretch="Fill" Width="150" HorizontalAlignment="Left" Margin="0,0,0,0" />
</StackPanel>
<Button Content="Save" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Button3" VerticalAlignment="Top" Width="75" Grid.Row="4" Grid.Column="1"/>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Button4" VerticalAlignment="Top" Width="75" Grid.Row="4" Grid.Column="0" />
</Grid>
</Grid>
</toolkit:BusyIndicator>
<!--<Grid x:Name="LayoutRoot" Background="White">
</Grid>-->
</UserControl>