tags:

views:

126

answers:

3

I created simple wcf service with default functionality and hosted in IIS7. Its working fine and rendering data to the client. But when I try to click on wsdl link in the service its showing "Page cannot be displayed".Let me know what will be the problem . When I try to click the link below (http://win-nsms.smsserver.com/VirtualFolder/MyService.svc?wsdl), WSDL file is not getting displayed in the browser. Instead I am getting "The page cannot be displayed" error in the page

Now If I change the "win-nsms.smsserver.com" to "localhost" in the URL, WSDL file is getting displayed.

Yes I added behaviour configuration in my config as follows

<system.serviceModel>
<services>
  <service name="WcfServiceSample.Service1" behaviorConfiguration="WcfServiceSample.Service1Behavior">       
    <endpoint address="" binding="wsHttpBinding" contract="WcfServiceSample.IService1">           
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
  <serviceHostingEnvironment>
    <baseAddressPrefixFilters>
      <add prefix="http://win-nsms.smsserver.com"/&gt;
    </baseAddressPrefixFilters>
  </serviceHostingEnvironment>
<behaviors>
  <serviceBehaviors>
    <behavior name="WcfServiceSample.Service1Behavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>      
</behaviors>

A: 

Did you enable WDS exposure? Standard settings dont show the WDSL.

TomTom
Please make it a bit clear, I didnt get ur poiny
vijay
A: 

Have you allowed retrieval of service meta data?

In the behaviours section of your config file, add a new behaviour like this:

<behaviors>
  <serviceBehaviors>
    <behavior name="HttpGetMetadata">
      <serviceMetadata httpGetEnabled="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

Then tell your service to use this behaviour:

<system.serviceModel>
    <services>
        <service name="MyService" 
                 behaviorConfiguration="HttpGetMetadata">
        ....

This is telling your service to allow the service metadata (the WSDL) to be retrieved via http. To confirm you can browse to the appropriate URL.

Kirk Broadhurst
A: 

Is "mymachinename.domainname.com" added as a hostmask in IIS for the site?

You may need to setup the base address for the service.

<serviceHostingEnvironment>
    <baseAddressPrefixFilters>
        <add prefix="http://mymachinename.domainname.com"/&gt;
    </baseAddressPrefixFilters>
</serviceHostingEnvironment>

I had a similar problem where the service was working 100% for domain.com but not www.domain.com. I had to setup the latter as a redirect to the former and set the base address to the former.

HTH!

Krisc
Hi Krisc,I added that in my config file now when I go for wsdl file its show ing 404 error.
vijay
If you go to mymachinename.domainname.com/VirtualFolder/MyService.svc, what server does the link to the WSDL refer to?Does it refer to localhost, or mymachinename.domainname.com ?What bindings do you have setup in IIS?Can you paste the full service portion of the configuration? Your original post looks like it was edited.
Krisc
Hi Krisc,I edited my question with service section of my config file.The following is the link getting displayed when I execute my appn http://win-nsms.smsserver.com/WcfServiceSample/Service1.svc?wsdl where WcfServiceSample is my virtual folder. when I click on that also its pointing to the same URL.
vijay
I am having trouble reproducing the error. It is running on your machine in IIS7, right? Or are you running it out of Visual Studio? The configuration (certainly without the base address) looks to be correct. It is my opinion that there is something else at play here. Are you sure the computer has the correct ports unblocked?
Krisc