이것이 작동하지 않는 이유를 발견했습니다. SharePoint 2010에서 경로 crossdomain.xml
및 clientaccesspolicy
은 가상 경로 공급자에서 제외되므로 SharePoint 콘텐츠 데이터베이스에서 제공되지 않습니다.
코드는 Sharepoint SPRequestModule
에 자리 잡고 있습니다 (아래 참조). 유일한 해결책은 crossdomain.xml
파일을 각 웹 서버의 IIS 루트에 배포하는 것인데, 이는 이상적인 방법이 아닙니다.
[SharePointPermission(SecurityAction.Demand, ObjectModel=true)]
void IHttpModule.Init(HttpApplication app)
{
if (app is SPHttpApplication)
{
if (!_virtualPathProviderInitialized)
{
lock (_virtualServerDataInitializedSyncObject)
{
if (!_virtualPathProviderInitialized)
{
Dictionary<string, ExclusionAttributes> dictionary = new Dictionary<string, ExclusionAttributes>(StringComparer.OrdinalIgnoreCase);
dictionary["/app_themes"] = ExclusionAttributes.Folder;
dictionary["/app_browsers"] = ExclusionAttributes.Folder;
dictionary["/defaultwsdlhelpgenerator.aspx"] = ExclusionAttributes.File;
dictionary["/clientaccesspolicy.xml"] = ExclusionAttributes.File;
dictionary["/crossdomain.xml"] = ExclusionAttributes.File;
VirtualPathProvider virtualPathProvider = HostingEnvironment.VirtualPathProvider;
if ((virtualPathProvider != null) && virtualPathProvider.DirectoryExists("/"))
{
VirtualDirectory directory = virtualPathProvider.GetDirectory("/");
if (directory != null)
{
IEnumerable children = directory.Children;
if (children != null)
{
foreach (VirtualFileBase base2 in children)
{
string str = base2.VirtualPath.TrimEnd(new char[] { '/' });
ExclusionAttributes attributes = 0;
if (base2.IsDirectory)
{
attributes |= ExclusionAttributes.Folder;
}
else
{
attributes |= ExclusionAttributes.File;
}
dictionary[str] = attributes;
}
}
}
}
_excludedFileList = dictionary;
SPVirtualPathProvider provider2 = new SPVirtualPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(provider2);
_virtualPathProviderInitialized = true;
}
SPTemplateFileSystemWatcher.Local.Initialize();
SPPerformanceCounterAgent current = SPPerformanceCounterAgent.Current;
}
}
app.BeginRequest += new EventHandler(this.BeginRequestHandler);
app.PostAuthenticateRequest += new EventHandler(this.PostAuthenticateRequestHandler);
app.PostAuthorizeRequest += new EventHandler(this.PostAuthorizeRequestHandler);
app.PostResolveRequestCache += new EventHandler(this.PostResolveRequestCacheHandler);
app.PostAcquireRequestState += new EventHandler(this.PostAcquireRequestStateHandler);
app.PreRequestHandlerExecute += new EventHandler(this.PreRequestExecuteAppHandler);
app.PostRequestHandlerExecute += new EventHandler(this.PostRequestExecuteHandler);
app.ReleaseRequestState += new EventHandler(this.ReleaseRequestStateHandler);
app.Error += new EventHandler(this.ErrorAppHandler);
app.PostLogRequest += new EventHandler(this.PostLogRequestHandler);
app.EndRequest += new EventHandler(this.EndRequestHandler);
}
}
남을 돕는 방법으로 질문에 대답 할 수 있습니까? 그렇게하면 정답으로 자신을 선택할 수 있습니다. 이상하게 보일 수도 있지만, 이와 같은 상황을 처리하는 데 선호되는 방법입니다. – Will