Common Issues


Error Message: “Unable to step in to the server”.

You may get this error while debugging from your source code to the additional code on different/same server.
For example Debugger is in a method ‘GetPatientDetailsList()’ and you press F11 to step in. If the source code is in your server/system, this issue can be resolved by pressing ‘Ctrl+alt+P’ or selecting the option ‘Debug->Attach to Process..’. Select W3WP.exe and press ok. If W3WP.exe is not showing on the Process list check the Option ‘Show Processes from all users’ or ‘Show Processes in all sessions’ as per your criteria and press ‘Refresh’ button to get new processes list. Select W3WP.exe and press ok. Though you are unable to get W3WP.exe , make sure whether you are having Admin access.If you are aware about this, do attach the process before step in [i.e Press F11 on the specific method on debugging].
When your source code is in different server, you have only consumed a particular service then the above work around will not help. In that case you can keep a local copy of the source code in your IIS.


Error Message: “The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'”


The main root cause of this issue is as the web service is running in the ASP.Net development web server, not in IIS ,authentication mode/default setting can be conflicted.  
Genarally, WCF uses anonymous authentication, whereas the ASP.Net development web server uses NTLM.
so you may change of  trying to make the development web server support anonymous authentication, but the simplest solution here is to change WCF to use NTLM authentication.


You may use this below code in client side. No change is needed from host or class library end.

            
            BasicHttpBinding mybinding=new BasicHttpBinding();

            EndpointAddress myaddress= new EndpointAddress("http://localhost:3127/");

            /*Below two lines is required */
            mybinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            mybinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;





Error Message: " There was no endpoint listening at http://SomeAddress:PortNo/ that could accept the message. This is often caused by an incorrect address or SOAP action."
Or,
"EndpointNotFoundException was unhandled."

First check with the address and port number you mentioned on client end whether it is correct and available or not. The same port number can be associated with other binding.
If the above you find are okay, Check with the Host Application is up and running or not. You may keep some message to ensure server started like below.

ServiceHost host = new ServiceHost(typeof(HelloWCFService));
host.Open();
Console.WriteLine("Server started");




Once you started an instance of the host (i.e. Right Click on ApplicationàDebugàStart New Instance), you may start your client application with the same debugging procedure.


Error Message: "Cannot obtain Metadata from http://localhost/XXX.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing..."


Add the below tag over Web.config file, which will enable sharing metadata with client(WSDL will be generated and accessible for client).

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 

After adding this if you found it is raising an issue(in some cases) as you have already an existing endpoint , so you may have a tag called a BaseAddress within Host as below which will help IIS to keep a base address and others endpoint address as a relative address.

   <host>
          <baseAddresses>           
             <add baseAddress="https://ServerName:PortNo/XYZ.Services" />
             <add baseAddress="https://localhost/XYZ.Services" />
          </baseAddresses>
   </host>



Error Message: "Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it" 

If you have implemented like below,i.e. Included session over your contracts....

[ServiceContract(Namespace = "http://localhost/xxx.Services/first.svc",SessionMode = SessionMode.Required)]
public interface IMyCalcService{ ...

and the Contracts like below

[OperationContract(Name = "TestmyLoginSoap", IsInitiating=true,IsTerminating=false)]       
ResultSet TestmyLogin(string userName, string password);

or any other Implementation of session then basicHttpBindings will not work as it is not handled Session whereas "wsHttpBinding" supports session for it's newer WS specification.




For any further issues you may connect me @   nit.pradip@gmail.com.


No comments:

Post a Comment