Web服务返回错误:找不到

本文关键字:找不到 错误 返回 服务 Web | 更新日期: 2023-09-27 18:20:14

我正在使用的web服务返回了web异常。服务是从Silverlight应用程序调用的。基本上,我正在尝试将eps文件转换为png。在localhost上,一切都很好,但当我部署在web服务器上时,我收到了这个错误。Silverlight代码是--

  private void btnUploadImage_Click(object sender, RoutedEventArgs e)
        {
            string fileextn = string.Empty;
            OpenFileDialog openDialog = new OpenFileDialog();
            if (openDialog.ShowDialog() == true)
            {
                try
                {
                    string fileExtension = openDialog.File.Extension.ToString();
                    if (fileExtension.Contains("jpeg") || fileExtension.Contains("jpg") || fileExtension.Contains("png") || fileExtension.Contains("tif") || fileExtension.Contains("tiff") || fileExtension.Contains("bmp") || fileExtension.Contains("gif"))
                    {
                        using (Stream stream = openDialog.File.OpenRead())
                        {
                            HtmlPage.Window.Invoke("showProcessingAndBlockUI");
                            // Don't allow really big files (more than 2 MB).
                            if (stream.Length < 5 * 1024 * 1025)
                            {
                                MemoryStream tempStream = new MemoryStream();
                                byte[] data = new byte[stream.Length];
                                stream.Position = 0;
                                stream.Read(data, 0, (int)stream.Length);
                                tempStream.Write(data, 0, (int)stream.Length);
                                stream.Close();
                                ProductConfiguratorServiceClient pcs = new ProductConfiguratorServiceClient();
                                string virtualpath = HelperClass.GetVirtual();
                                pcs.Endpoint.Address = new System.ServiceModel.EndpointAddress(virtualpath + "/Services/ProductConfiguratorService.svc/basic");
                                pcs.GetFormattedImageCompleted += new EventHandler<GetFormattedImageCompletedEventArgs>(pcs_GetFormattedImageCompleted);
                                pcs.GetFormattedImageAsync(data);
                                pcs.CloseAsync();
                                tempStream.Close();
                            }
                            else
                            {
                                MessageBox.Show("Files must be less than 5 MB.");
                            }
                        }
                    }
                    else if (openDialog.File.Extension.Contains("eps"))
                    {
                        HtmlPage.Window.Invoke("showProcessingAndBlockUI");
                        using (Stream stream = openDialog.File.OpenRead())
                        {
                            if (stream.Length < 5 * 1024 * 1025)
                            {
                                MemoryStream tempStream = new MemoryStream();
                                byte[] data = new byte[stream.Length];
                                stream.Position = 0;
                                stream.Read(data, 0, (int)stream.Length);
                                tempStream.Write(data, 0, (int)stream.Length);
                                stream.Close();
                                ProductConfiguratorServiceClient pcs = new ProductConfiguratorServiceClient();
                                string virtualpath = HelperClass.GetVirtual();
                                pcs.Endpoint.Address = new System.ServiceModel.EndpointAddress(virtualpath +                                                                                              "/Services/ProductConfiguratorService.svc/basic");
                                pcs.GetEpsFileIntoPngCompleted += new EventHandler<GetEpsFileIntoPngCompletedEventArgs>(pcs_GetEpsFileIntoPngCompleted);
                                pcs.GetEpsFileIntoPngAsync(data);
                                tempStream.Close();
                            }
                            else
                            {
                                MessageBox.Show("Files must be less than 5 MB.");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please Check the Image Format.");
                    }
                }
                catch (Exception)
                {
                    HtmlPage.Window.Invoke("hideBlockUI");
                    MessageBox.Show("Somr Error Occured, Please Try Again Later .");
                }
            }
        }
        void pcs_GetEpsFileIntoPngCompleted(object sender, GetEpsFileIntoPngCompletedEventArgs e)
        {
                busi.CurrentlySelectedOverlayImage.UploadedImageStream = e.Result;
                busi.CurrentlySelectedOverlayImage.ImageFileType = "png";
                RefreshStatus();
                busi.CurrentlySelectedOverlayImageChanged = true;
                HtmlPage.Window.Invoke("hideBlockUI");
        }
        void pcs_GetFormattedImageCompleted(object sender, GetFormattedImageCompletedEventArgs e)
        {
            try
            {
                if (e.Error != null)
                {
                    MessageBox.Show(e.Error.ToString());
                }
                else
                {
                    busi.CurrentlySelectedOverlayImage.UploadedImageStream = e.Result;
                    busi.CurrentlySelectedOverlayImage.ImageFileType = "jpeg";
                    RefreshStatus();
                    busi.CurrentlySelectedOverlayImageChanged = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            //throw new NotImplementedException();
        }

错误位于System.Net.Browser.BrowserHttpWebRequest

请问这是什么问题?

Web服务返回错误:找不到

这可能与此行有关。

pcs.Endpoint.Address = new System.ServiceModel.EndpointAddress(virtualpath + 

你错过了剩下的。很确定这是一个编译错误。

所以,要么这个错误被吃掉了,普通的错误出现了,要么你还有其他问题。