I have created a custom web page which uses a component's TcmUri from the query string and provides the functionality to perform some operations on it. This Web Apllication is deployed within the Tridion CMS.
The page works fine when I run it from my local machine in Visual Studio (and pass a TcmUri in Query string). But when I deploy the webpage in Tridion CMS. I get the following error:
Exception:The server has rejected the client credentials.
The code to connect to core service is:
private SessionAwareCoreServiceClient _client;
private string _strAddress;
private EndpointAddress _endpointAddress;
_strAddress = "net.tcp://hostname:2660/CoreService/2011/netTcp";
_endpointAddress = new EndpointAddress(_strAddress);
NetTcpBinding binding = new NetTcpBinding { MaxReceivedMessageSize = 2147483647 };
XmlDictionaryReaderQuotas quota = new XmlDictionaryReaderQuotas
{
MaxStringContentLength = 2147483647,
MaxArrayLength = 2147483647,
};
binding.ReaderQuotas = quota;
_client = new SessionAwareCoreServiceClient(binding, _endpointAddress);
_client.ChannelFactory.Credentials.Windows.ClientCredential = new NetworkCredential("computername\\username","password" );
_client.Impersonate("Hardcoded Other User Name");
Web.Config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
</controls>
</pages>
</system.web>
<appSettings>
</appSettings>
</configuration>
The custom WebPage is deployed at (%Tridion_Home%)\WebUI\Editors\CustomPublishItem. The web.config is deployed at the same location.The DLL Associated with this page is deployed at location (%Tridion_Home%)\WebUI\WebRoot\bin.
The Custom Page is available as a context option for all components in Tridion CMS. When I select a component and open the page. I get the error mentioned above. In the server, the application event log displays:
The server has rejected the client credentials.
The server has rejected the client credentials.
The logon attempt failed
Component: Tridion.ContentManager.CoreService
Errorcode: 0
User: NT AUTHORITY\NETWORK SERVICE
StackTrace Information Details:
at System.Net.Security.NegoState.StartSendAuthResetSignal(LazyAsyncResult lazyResult, Byte[] message, Exception exception)
at System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.CheckCompletionBeforeNextSend(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.ProcessReceivedBlob(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.CheckCompletionBeforeNextSend(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.ProcessReceivedBlob(Byte[] message, LazyAsyncResult lazyResult)
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.NegotiateStream.AuthenticateAsServer(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
at System.ServiceModel.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgrade(Stream stream)
at System.ServiceModel.Channels.InitialServerConnectionReader.UpgradeConnection(IConnection connection, StreamUpgradeAcceptor upgradeAcceptor, IDefaultCommunicationTimeouts defaultTimeouts)
at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump()
However, the page works fine in my local machine in Visual Studio.
Please note that I do not get any error in case of basic_Http. The Tridion Version is 2011 SP 1.
What am I doing wrong.
Edit:
The username and password is of administrator, which is already added in Impersonation Users