Link to home
Start Free TrialLog in
Avatar of fmichail
fmichailFlag for Canada

asked on

problem in creating a service reference in vs2008

I am trying to reference the wcf service
http://ExpRefund.tst.retro.mycompany.net/ExpRefundFacade.svc/ExpRefundFacade
after entering this url and press GO it says could not find service

I tried the following without success:
http://ExpRefund.tst.retro.pacificlife.net/ExpRefundFacade.svc

However, if I use http://ExpRefund.tst.retro.pacificlife.net/ExpRefundFacade.svc in the browser, I get the service.... By the way the service is working fine in the application, however I want to add a reference to it in another new application but is not accepting... I must be doing something wrong, could anyone help please. Thanks

by the way if the svc is in the localhost, and I use [discover] button, it is correctly selected.
Avatar of Aaron Jabamani
Aaron Jabamani
Flag of United Kingdom of Great Britain and Northern Ireland image

can we see your wcf service config please. Do you get any error inside VS2008 ?
Avatar of fmichail

ASKER

Hi apeter

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      <bindings>
            <basicHttpBinding>
                  <binding name = "secureMsg" maxReceivedMessageSize="94371840">
                                  <readerQuotas maxStringContentLength="94371840" />
                                  <security mode="TransportCredentialOnly">
                        <transport clientCredentialType="Windows" proxyCredentialType="Windows" />
                        </security>
                  </binding>
            </basicHttpBinding>
      </bindings>

      <services>
            <service name="FI.Facade.FIFacade" behaviorConfiguration="Debug_Behaviour">
                  <host>
                        <baseAddresses>
                              <add baseAddress = "http://fi.tst.retro.mycompany.net" />
                        </baseAddresses>
                  </host>
                  <endpoint
                        address="FIFacade"
                        binding="basicHttpBinding"
                        bindingConfiguration="secureMsg"
                        contract="FI.Interface.IFIFacade" />
            </service>
      </services>
      <behaviors>
            <serviceBehaviors>
                  <behavior name="Debug_Behaviour">
                  <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
                  <serviceMetadata httpGetEnabled="true" />
                  <serviceAuthorization principalPermissionMode="UseWindowsGroups" />
                  </behavior>
            </serviceBehaviors>
      </behaviors>
</system.serviceModel>
Aren't you missing Mex endpoint for your service? Returning metadata about an WCF service allows consumers of a service to easily create clients for the service

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
apeter,
I will try that and let you know. do you mean that I just add this end point, and then I can create a service reference to it? what should I use,

http://ExpRefund.tst.retro.mycompany.net/ExpRefundFacade.svc/ExpRefundFacade

or

http://ExpRefund.tst.retro.mycompany.net/ExpRefundFacade.svc
Hi apeter

I did add the Mex endpoint. and when I tried to create a service reference, entered the url (I tried both), and when I press GO I get the message indicating not able to reach the url

User generated image
It may look like I do not have permission, however, if I use the url in the browser, I get the service displayed correctly. what do you think?
You should create a proxy/reference using this URL, http://ExpRefund.tst.retro.mycompany.net/ExpRefundFacade.svc.
apeter
is'nt this what I am trying to do when I create a service reference, in other words is there another way to create the proxy

Here is what I did

User generated image
You have create a proxy to the service and not to a method in a service directly. You should use this url,  http://ExpRefund.tst.retro.mycompany.net/ExpRefundFacade.svc  
to create a service reference.
Dear apeter
I used the url as you indicated and I get the same message. By the way, I am using the real company name instead of [mycompany]. Here it is

User generated image
Can you please click on the "Details" link and get error details ?
Hi apeter
sorry for the delay, I was out of country for few days.

The main part in the error is

Metadata contains a reference that cannot be resolved: 'http://exprefund.stg.retro.pacificlife.net/ExpRefundFacade.svc'.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
The remote server returned an error: (401) Unauthorized.
If the service is defined in the current solution, try building the solution and adding the service reference again.


What is confusing is that when I use this url in the browser (on the same PC with the same credential) I get the service operations showing normally
Hi apeter

I read the link, and tried the followng:
set the application pool to work for Anonymous access
Tried change the service web.config to set the clientCredentialType="Ntlm"
proxyCredentialType="None"

and every time I restarted the www publishing service. Still getting an error that the url could not be resolved. I tried again the direct targeting the url from the browser, and it works OK. It is just the problem in trying to create a service reference in VS 2008. Sorry apeter, to bug you again. Thanks
Can you please try opening VS2008 in "Administration" mode and try adding reference.

Check out this link, https://social.msdn.microsoft.com/Forums/en-US/0071720f-68e0-4d29-bc7c-3b96d33cb38c/problem-while-adding-reference-of-my-wcf-service?forum=wcf  Hope it helps.
Hi apeter

I tied opening vs2008 as administrator, and got te same problem. I tried to create a service on my machine, and tried to reference it. This is OK but not from the server. Keep on please. Thanks
Enable tracing on wcf service. It might give more clues of the error.

Use this link to enable tracing,  https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx
Sorry apeter, nothing was written to the trace file when I try to create a service reference from VS 2008.
That mean, your request didn't reach WCF service.  something is preventing your call.
Looks like, however,

If I try to access the webservice from the browser using same url it works indicating I have the correct URL and correct permissions
If I use the same steps on a service on my local drive it works indicating I am following the corerct steps

I cannot understand
Within visual studio we can browse. Can you access your service in the visual studio browser.
Sorry apeter I almost gave up. and did not check the question status for the last period, please accept my apologies.

What is the visual studeo browser? It would be great if you can provide a screenshot. I appreciate your help.
Go to VS Menu : View -> other windows -> web browser.   This opens a browser inside VS.
I will try this on Monday when I am back at work. however, I tried the url from the normal browser (outside of vs 2008)          and it works fine
Hi apeter,
I tried again and this time, I could not even open the link in the browser (the general browser). I see this as at least consistent. Here is the message
Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service

The application is running on IIS6, and is hosted in an application pool. I tried to open the properties of the pool, however, I could not find anything about security it is as shown hereUser generated image
How to change the setting to enable windows Authentication?. I think we are getting there. Thanks apeter
It will be there in the  Site's Feature View. Go to IIS Manager.  Select the site where you have hosted your service. In the Features view , you have look for authentication section.User generated image
Hi apeter,
I tried from the browser in VS 2008, and it works fine, however, It still not accessible when I try to create the service reference using the same url and clicking Go. (I selected another service rather than the other one I was trying against).

User generated image
I checked the authentication, and it indicates windows authentication is enabled (however, it indicates "No Anonymous access".
ASKER CERTIFIED SOLUTION
Avatar of Aaron Jabamani
Aaron Jabamani
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
apeter,
It Worked..... !!!
I appreciate your help so much .. I followed the last part of the Microsoft link you sent me, and here are the steps I followed:

In the [Add service reference] Dialog click [Advanced Button]
In the [service reference setting] dialog click [Add web reference] button
In the [Add web reference] dialog enter the URL, and the service interface will show. click [Add Reference] after setting the name

It looks like for some reason, I had a compatibility issue (I do not know what it is) which was resolved by using the compatibility mode (compatible with Framework 2. Thanks so much apeter.