我試圖在.NET Core中執行SSRS報告。在.NET Core中對ReportExecution2005.asmx進行身份驗證
由於.NET Core不允許添加服務引用,因此您必須使用WCF連接服務來添加對WSDL的引用,以便它可以生成與.NET Core兼容的代碼。這是我爲ReportExecution2005.asmx做的(如果它很重要的話,SQL Server 2016)。
我試着用下面來對服務進行身份驗證:
var rsExec = new ReportExecutionServiceSoapClient(ReportExecutionServiceSoapClient.EndpointConfiguration.ReportExecutionServiceSoap,
new EndpointAddress("http://server/ReportServer/ReportExecution2005.asmx"))
{
ClientCredentials =
{
Windows =
{
AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation,
ClientCredential = new NetworkCredential("username", "password")
}
}
};
還試圖設置用戶名對象而不是Windows對象,但無論哪種方式,其結果是出現以下錯誤:
MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'.
看着Fiddler,代碼不會傳遞證書。
這是得到了產生斷WSDL
public ReportExecutionServiceSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress)
: base(ReportExecutionServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
{
this.Endpoint.Name = endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}
static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
我可能是錯的,但不是這個調用私有方法ConfigureEndpoint與對象,甚至被設置ClientCredentials前ClientCredentials對象的代碼?
我沒有看到任何其他配置ClientCredentials或調用ConfigureEndpoint的方式,那麼您應該如何進行身份驗證?其他的構造函數基本上是一樣的,除了一個接受Binding而不是EndpointConfiguration的構造函數。有任何想法嗎?
另外,我知道我可以把這個變成一個.net庫中,並從那裏引用它,但我想嘗試和只需使用.NET Core即可使用它。 – Brandon
您的安全模型是如何設置的?您是否在ssrs實例上使用本地用戶從ssrs請求?如果是,該用戶是否有權這樣做? –
另一件事是檢查你的wfc綁定的傳輸安全配置。 –