C# 服务器上未运行Silverlight应用程序
我有一个使用silverlight的.NET应用程序。 在页面加载时,我的控件未被呈现,出现以下错误-C# 服务器上未运行Silverlight应用程序,c#,asp.net,silverlight,C#,Asp.net,Silverlight,我有一个使用silverlight的.NET应用程序。 在页面加载时,我的控件未被呈现,出现以下错误- Microsoft JScript runtime error: Unhandled Error in Silverlight Application The remote server returned an error: NotFound. at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMetho
Microsoft JScript runtime error: Unhandled Error in Silverlight Application The remote server returned an error: NotFound. at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at MultipleUpLoad.Upload_page.GetEventListCallBack(IAsyncResult res)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass19.<InvokeGetResponseCallback>b__17(Object state2)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
因为它只发生在服务器上,所以似乎是环境问题。我应该检查什么
下面是我的localLeft handside控件上正确呈现的屏幕:
下面是在服务器上部署时左侧控件未正确呈现的情况
我控制的代码-
<DataTemplate x:Key="myTaskTemplate">
<StackPanel Orientation="Horizontal" Width="Auto" >
<TextBlock Margin="5,5,5,5" Width="175" Height="20" FontSize="11" Text="{Binding EventName}" />
<StackPanel Orientation="Vertical" Width="auto">
<TextBox Margin="5,5,5,1" Width="150" Height="20" IsReadOnly="true"></TextBox>
<ProgressBar Margin="1,1,1,1" Width="150" Height="8"></ProgressBar>
</StackPanel>
<Button VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="5,5,5,5"
Content="Upload" Width="80" Height="25" VerticalAlignment="Top" FontSize="11" Click="uploadBtnClick_EventHandler" Tag="{Binding EventName}"></Button>
<!--<CheckBox Margin="5,5,5,5" VerticalAlignment="Top" ></CheckBox>-->
<Ellipse Height="15" HorizontalAlignment="Left" Width="15" Stroke="LightGray" StrokeThickness="2"/>
<Button VerticalContentAlignment="Center" IsEnabled="False" HorizontalContentAlignment="Center" Margin="5,5,5,5" Content="Edit Mapping" Width="110" Height="25" VerticalAlignment="Top" FontSize="11" Click="editMapping_click"></Button>
</StackPanel>
</DataTemplate>
代码隐藏:
public Upload_page()
{
appln = (App)Application.Current;
UploadDataUri = appln.DeploymentConfigurations["Silverlight_Config_UploadFileURI"];
LoadDataUri = appln.DeploymentConfigurations["Silverlight_Config_LoadDataURI"];
UploadUsingWebClientUri = appln.DeploymentConfigurations["Silverlight_Config_UploadUsingWebClientUri"];
GetEventListUri = appln.DeploymentConfigurations["Silverlight_Config_GetEventListUri"];
LoginUri = appln.DeploymentConfigurations["Silverlight_Config_LoginUri"];
InitializeComponent();
// filelist = new List<FileInfo>();
((TextBox)FindName("dataloadUri")).Text = LoadDataUri;
((TextBox)FindName("receiverUri")).Text = UploadDataUri;
// Initialize EventList
InitializeEventList();
}
public void InitializeEventList()
{
HttpWebRequest rq = (HttpWebRequest)WebRequestCreator.BrowserHttp.Create(new Uri(GetEventListUri));
rq.Method = "POST";
rq.Headers["EventName"] = "GetEventList";
rq.BeginGetResponse(GetEventListCallBack, rq);
}
public void GetEventListCallBack(IAsyncResult res)
{
HttpWebRequest rq = (HttpWebRequest)res.AsyncState;
using (HttpWebResponse httpResponse = (HttpWebResponse)rq.EndGetResponse(res))
{
using (Stream dataStream = httpResponse.GetResponseStream())
{
StreamReader reader = new StreamReader(dataStream);
var result = reader.ReadToEnd();
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
var doc = XDocument.Parse(result);
var error = (from p in doc.Descendants("Error") select p).ToList();
if (error.Count == 0)
{
eventList = (from p in doc.Descendants("mEvent") select GetEvent(p)).ToList();
LayoutRoot.DataContext = eventList;
}
else
{
//redirect to userLogin
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(LoginUri));
}
}
);
}
}
//_autoEvent.Set();
NotFound通常是底层wcf服务引发的序列化问题。启用svc跟踪日志记录,并在收到异常后检查日志。没有底层WCF服务。注意:那么如何调用服务器?无论如何,请尝试启用它,有关更多信息,请参见此:您可以发布您的c代码吗?编辑了我的问题以包含代码。