2010-07-03 2 views
0

SharePoint 프로젝트를 Excel 문서로 읽을 수있는 C# 콘솔 프로젝트를 만들면 모든 것이 잘 동작합니다. 내가 Silverlight 응용 프로그램에서 엑셀 파일 데이터를 읽으려고 할 때 문제가하는 예외는 아래와 같이 팝업 :System.ServiceModel.CommunicationException : 엑셀 서비스로 데이터를 읽는 Silverlight 응용 프로그램

{System.ServiceModel.CommunicationException: An error occurred while trying to make a request to URI 'http://phc/_vti_bin/excelservice.asmx'. 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. ---> System.Security.SecurityException ---> System.Security.SecurityException: Security error. 
    at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 
    at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState) 
    at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState) 
    --- End of inner exception stack trace --- 
    at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) 
    at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) 
    --- End of inner exception stack trace --- 
    at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) 
    at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result) 
    at CERViewer.ESW.ExcelServiceSoapClient.ExcelServiceSoapClientChannel.EndOpenWorkbook(IAsyncResult result) 
    at CERViewer.ESW.ExcelServiceSoapClient.CERViewer.ESW.ExcelServiceSoap.EndOpenWorkbook(IAsyncResult result) 
    at CERViewer.ESW.ExcelServiceSoapClient.EndOpenWorkbook(IAsyncResult result, ObservableCollection`1& status) 
    at CERViewer.ESW.ExcelServiceSoapClient.OnEndOpenWorkbook(IAsyncResult result) 
    at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)} 

소스 코드 :

private void GetFeatures() 
    { 
     ExcelServiceSoapClient = new ExcelServiceSoapClient(); 
     string targetWorkbookPath = "http://phc/Shared%20Documents/sample.xlsx"; 

     xlservice.OpenWorkbookCompleted += new EventHandler<OpenWorkbookCompletedEventArgs>(xlservice_OpenWorkbookCompleted); 
     xlservice.OpenWorkbookAsync(targetWorkbookPath, "en-US", "en-US"); 
    } 

    void xlservice_OpenWorkbookCompleted(object sender, OpenWorkbookCompletedEventArgs e) 
    { 
     sessionId = (string)e.Result; //exception here!!! 
    } 

나는 아래의 방법을 시도하지만, 모두 실패했습니다.

1 : 파일을 만들고 "C : \ Program Files \ Common Files \ Microsoft 공유 \ Web Server Extensions \ 14 \ isapi \"에 넣습니다. 그러나 다시 실패했습니다.

2 : 내가 셰어와 실버의 발전에 완전히 새로운 오전 여기 SharePoint 서버의 도메인 간 통합 문서 및 데이터 연결 액세스,

를 열고, 나는 그물에 주위를 검색하지만 답을 찾을 수 없습니다. 누구든지 나를 도울 수 ???

답변

0

서버 루트에 clientaccesspolicy.xml 파일을 넣어서 문제를 해결했습니다.