在Episerver项目中,从一个服务器上的网站到另一个服务器上的ASMX-webservice进行调用。 用户调用可以在IIS 7中设置,以便从文件夹中编写,创建和检索文件。
进行此调用时会出现以下错误消息:
RemotePublishForLedigeStillinger.DataFactoryService.RawPage rawPageLedigeStillingerRemote = dfService.GetDefaultPageData(pageRef, Int32.Parse(pageidOfLedigeStillingar));
如何解决以下错误?:
Detailed error information (authorized by permissions to functions)
Error occured 01.10.2012 14:35:07
User IP 172.29.2.84
User Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1
Url ....
Referer ...
The request failed with HTTP status 401: Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The request failed with HTTP status 401: Unauthorized.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +431289
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
RemotePublishForLedigeStillinger.DataFactoryService.DataFactoryService.GetDefaultPageData(PageReference pageLink, Int32 pageTypeID) in C:\Programmering\RemotePublishTest\RemotePublishTest\Web References\DataFactoryService\Reference.cs:147
RemotePublishForLedigeStillinger.Program.PublishPageToRemoteService(PageData pageLedigeStillingerOriginal) in C:\Programmering\RemotePublishTest\RemotePublishTest\Program.cs:143
EPiServer.Templates.RelatePlus.Pages.JobAd.RemotePublishPage(PageData pageToPublish) in C:\Repo\Projects\dikt.intranett\www\Templates\RelatePlus\Pages\JobAd.aspx.cs:125
EPiServer.Templates.RelatePlus.Pages.JobAd.Godkjent_OnClick(Object sender, EventArgs e) in C:\Repo\Projects\dikt.intranett\www\Templates\RelatePlus\Pages\JobAd.aspx.cs:110
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
IIS-log显示了这个:
2002:5100:9dbc:8000:0:5efe:10.50.0.227, -, 10/1/2012, 14:52:20, W3SVC2, DRINVS253, 2002:5100:9dbc:8000:0:5efe:10.50.0.160, 15, 775, 1700, 401, 0, POST, /WebServices/DataFactoryService.asmx, -,
2002:5100:9dbc:8000:0:5efe:10.50.0.227, dr-2\epi.admin, 10/1/2012, 14:52:20, W3SVC2, DRINVS253, 2002:5100:9dbc:8000:0:5efe:10.50.0.160, 0, 806, 1700, 401, 0, POST, /WebServices/DataFactoryService.asmx, -,
部署了Web服务的服务器上的web.config中的一些数据:
<episerver.basicAuthentication sendBasicChallenge="true" basicRealm="" />
<system.web>
<httpModules>
<add
name="BasicAuthentication"
type="EPiServer.Security.BasicAuthentication, EPiServer" />
</httpModules>
<httpRuntime maxRequestLength="1000000" />
<authorization>
<allow roles="Administrators,WebServices,dr-2\epi.admin" />
<deny users="*" />
</authorization>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="BasicAuthentication" type="EPiServer.Security.BasicAuthentication, EPiServer" />
</modules>
<handlers>
<clear />
<add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
<add name="WebServiceHandlerFactory-Integrated" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />
<add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />
</handlers>
</system.webServer>
增加: 用户是'dr-2 \ epi-admin'。
其登录详细信息将发送到服务器:
public DataFactoryService() {
this.Url = System.Configuration.ConfigurationManager.AppSettings[urlForLedigeStillingerRemoteServiceStringFromAppSettingsGlobal];
this.UseDefaultCredentials = true;
//.Default.RemotePublishForLedigeStillinger_DataFactoryService_DataFactoryService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
删除'deny'标签后,请求会被进一步处理,我知道收到此错误:
或发生01.10.2012 15:39:56用户IP 172.29.2.84用户 代理Mozilla / 5.0(Windows NT 6.1; WOW64; rv:15.0)Gecko / 20100101 火狐/ 15.0.1 网址[删除了网址]
Referer [Url已删除] System.Web.Services.Protocols.SoapException:服务器无法执行 处理请求。 ---&GT; EPiServer.Core.EPiServerException:用户这样做 没有“Permission.WebServiceAccess”访问权限的访问权限 远程站点上的服务,供用户使用 EPiServer.WebServices.DataFactoryService.ValidateWebServiceAccess()
在 EPiServer.WebServices.DataFactoryService.GetDefaultPageData(PageReference pageLink,Int32 pageTypeID)---内部异常堆栈跟踪的结束 ---描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪了解更多信息 有关错误的信息以及它在代码中的起源。异常详细信息:System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException:服务器无法执行 处理请求。 ---&GT; EPiServer.Core.EPiServerException:用户这样做 没有“Permission.WebServiceAccess”访问权限的访问权限 远程站点上的服务,供用户使用 EPiServer.WebServices.DataFactoryService.ValidateWebServiceAccess()
在 EPiServer.WebServices.DataFactoryService.GetDefaultPageData(PageReferencepageLink,Int32 pageTypeID)---内部异常堆栈跟踪结束
源错误:在此期间生成了未处理的异常 执行当前的Web请求。有关原产地的信息 可以使用异常来识别异常的位置 堆栈跟踪下面。
堆栈追踪:
[SoapException:System.Web.Services.Protocols.SoapException:Server 无法处理请求。 ---&GT; EPiServer.Core.EPiServerException: 用户没有“Permission.WebServiceAccess”访问权限 访问远程站点上的Web服务,供用户访问 EPiServer.WebServices.DataFactoryService.ValidateWebServiceAccess()
在 EPiServer.WebServices.DataFactoryService.GetDefaultPageData(PageReference pageLink,Int32 pageTypeID)---内部异常堆栈跟踪的结束 ---] System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage) 消息,WebResponse响应,流responseStream,布尔值 asyncCall)+431766
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(字符串 methodName,Object []参数)+204
RemotePublishForLedigeStillinger.DataFactoryService.DataFactoryService.GetDefaultPageData(PageReference pageLink,Int32 pageTypeID)in C:\ Programmering \ RemotePublishTest \ RemotePublishTest \ WEB 参考\ DataFactoryService \ Reference.cs:148个
RemotePublishForLedigeStillinger.Program.PublishPageToRemoteService(PageData pageLedigeStillingerOriginal)in C:\ Programmering \ RemotePublishTest \ RemotePublishTest \的Program.cs:143
EPiServer.Templates.RelatePlus.Pages.JobAd.RemotePublishPage(PageData pageToPublish)in C:\回购\项目\ dikt.intranett \ WWW \模板\ RelatePlus \网页\ JobAd.aspx.cs:125 EPiServer.Templates.RelatePlus.Pages.JobAd.Godkjent_OnClick(对象 发件人,EventArgs e)in C:\回购\项目\ dikt.intranett \ WWW \模板\ RelatePlus \页数\ JobAd.aspx.cs:110 System.Web.UI.WebControls.Button.OnClick(EventArgs e)+111
System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串 eventArgument)+110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 eventArgument)+10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint) 1565
答案 0 :(得分:0)
乍一看,它看起来好像匿名用户和/或托管服务的应用程序池的标识没有枚举“角色”中指定的组dr-2 \ epi.admin的权限。 ..allow“您的配置文件的块...或者调用用户身份不属于这些角色,并且默认拒绝规则适用。