WSDL file is not getting generated for WCF WebService
-
Monday, June 16, 2008 11:49 PMHi,
I am creating simple wcf webservice and try to consume from the console application.
I am getting the following error when try to do "Add Web Refference" from my console application.
There was an error downloading 'http://machinename.domainname.com/VirtualFolder/MyService.svc?wsdl'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it
Even i am not able to view WSDL file in the browser by VS 2005. But instead of machinename.domainname.com giving in the url , If i give localhost i am able to view the wsdl file
I tried using svcutil.exe form the command line. i am getting same error.
Same code is working in other machines. Is there any settings do i need to make in IIS?
Following is my Config file Settings.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<!-- Admin Service -->
<service name="ServiceName" behaviorConfiguration="returnFaults">
<endpoint contract="IServiceName" binding="basicHttpBinding"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Pls. help me to resolve this problem.
Thanks in Advance.
Thanks,
Antony SJ
All Replies
-
Tuesday, June 17, 2008 6:19 AMModeratorHi,
First, try to add
<endpoint contract="IMetadataExchange" address="mex" binding="mexHttpBinding" />
To your list of endpoints, and try to point svcutil.exe against
http://machinename.domainname.com/VirtualFolder/MyService.svc/mex
or
http://machinename.domainname.com/VirtualFolder/mex
Good luck,
--larsw -
Thursday, June 19, 2008 10:45 PM
Hi,
Thanks a lot for your reply. Still same error persists after changing the config settings in web.config file.
If I run SVCUTIL.EXE, I am getting following error:
C:\>svcutil.exe http://machinename.domainname.com/VirtualFolder/MyService.svc/mexIf you would like more help, type "svcutil /?"
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://machinename.domainname.com/VirtualFolder/MyService.svc/mex'
using WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot obtain Metadata from http://machinename.domainname.com/VirtualFolder/MyService.svc/mex
If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess. For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
URI:http://machinename.domainname.com/VirtualFolder/MyService.svc/mex
Metadata contains a reference that cannot be resolved: 'http://machinename.domainname.com/VirtualFolder/MyService.svc/mex'.
Could not connect tohttp://machinename.domainname.com/VirtualFolder/MyService.svc/mex
ex. TCP error code 10061: No connection could be made because the target machine
actively refused it.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it
HTTP GET Error
URI: 'http://machinename.domainname.com/VirtualFolder/MyService.svc/mex'
There was an error downloading 'http://machinename.domainname.com/VirtualFolder/MyService.svc/mex'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it
What I am missing in here? It is a simple service trying to run from my machine.
Anvanced thanks for your help.
Thanks
Antony SJ -
Friday, June 20, 2008 12:35 AM
You mentioned the following url works.
http://localhost/VirtualFolder/MyService.svc?wsdl
But not,
http://machinename.domainname.com/VirtualFolder/MyService.svc?wsdl
Try pinging machinename.domainname.com. Does the ip address matches your computer ip address?
Check the computer name by going to "System Properties" and clicking on the Computer Name tab.
HTH,
An
-
Friday, June 20, 2008 4:39 PM
Hi,
Thanks for your reply.
When I run my simple WCF Service project, I am getting success message "You have created a service." But When I try to click the link below (http://machinename.domainname.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 "machinename.domainname.com" to "localhost" in the URL, WSDL file is getting displayed.
I have pinged machinename.domainname.com... IP Address maches my computer name and I checked the Computer Name in the System Propertity also. It looks same.
But Still, I am not able to solve this Problem
Help me out in resolving this issue.
Thanks,
Antony -
Friday, June 20, 2008 5:51 PM
Okay, I think I got it. Correct me if i am wrong.
I think you have either a WCF Service Web Site project or a WCF service application. This project is not located under the c:\inetpub\wwwroot folder. (For WCF Service Web Site project by default, the location of your projects files are under "My Documents\Visual Studio 2008\WebSites" and the solution files are under "My Documents\Visual Studio 2008\Projects". For WCF service application, by default, the location of your project is the location of your last project you created.)
When you hit the play button, the ASP.NET Development server starts up and hosts the service. Then, you use the "localhost" name to query for the wsdl and it works.
It doesn't work with "machinename.domainname.com" because when you use that, IIS intercepts the request and because it is not hosting that web application, it complains the page is not found.
Since you are developing your service on your local machine, you can continue to use localhost to query for the wsdl.
When you publish the web application to a remote server, you can use the "<machinename>.<domainname>.com", where <machinename>.<domainname>.com is the remote server name.
If you want to use machinename.domainname.com in addition to localhost in your development environment,
either
1) create the wcf service web site under the C:\inetpub\wwwroot.
or
2) create a wcf service application under the c:\inetpub\wwwroot.
or
2) create a virtual folder, called "VirtualFolder" and have it point to the folder location of the web application.
Unless you need the service available at all times in development, I would just use localhost. less hassle and more flexibility in where you put your project files.
Let me know if this works for you,
thanks,
An
-
Monday, June 23, 2008 7:22 PM
Hi,
Thanks for your answer.
But still I am not out of this problem yet.
I am using Visual Studio 2005 and creating WCF Service Project by following method.
FILE -> NEW WEBSITE -> "WCF SERVICE"
selecting LOCATION DROPDOWN AS HTTP
and I checked Project is getting created c:\inetpub\wwwroot folder. and solution file is getting generated under
\Documents and Settings\WINDOWS_USER_ID\My Documents\Visual Studio 2005\Projects\ProjectName
When I run the simple WCF service project, It asked me change some of the config settings. I have chnaged the config settings by adding following construct in the web.config file.
added in service Tag
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
added in behaviour Tag
<serviceMetadata httpGetEnabled="true" />
After adding above elements in the web.config, If run the project, i am getting message like "You have created a service."
But If i click the wsdl link shown below... I am not getting wsdl instead i am getting "The page cannot be displayed"
Please write to me if i am not clear in explaining.
Thanks,
Antony SJ -
Tuesday, June 24, 2008 9:07 PM
Hi AntonySJ,
While using svcutil.exe use the following command. You don't need "/mex" after .svc file. And also make sure that IIS is running while performing this command.
C:\>svcutil http://machinename.domainname.com/VirtualFolder/MyService.svc
Let me know if it worked. I have created a Service as you mentioned and I am able to get the WSDL in browser as well as the proxy and output.config files to a folder.
Thanks.
-
Tuesday, June 24, 2008 10:13 PM
If you are unable to get the proxy and output.config files generated (for client application) by following the steps that I mentioned in my previous message, please post the contents of your Service's web.config file here (you can generalize or hide your company or machine names).
Thanks.
-
Wednesday, June 25, 2008 12:37 AM
I followed the steps you mentioned and I am able to get a wsdl file.
You only have Visual studio 2005 and .net 3.0 installed on this machine right? Did you install a pre-release of WCF on this machine?
Can you go to the following folder and run "ServiceModelReg.exe -vi"?
C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg.exe -vi
Execute ServiceModelReg.exe again but this time with -lv switch.
Can you paste the outputs?
Thanks,
An
-
Monday, June 30, 2008 10:01 PM
Hi,
Sorry for delayed reply. Still propblem persists.
Following is the output for ServiceModelReg.exe -vi
Microsoft(R) Windows Communication Foundation Installation Utility
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Machine.config Section Groups and Handlers : Default Installation
System.Web Build Provider : Default Installation
System.Web Compilation Assemblies : Default Installation
HTTP Handlers : Default Installation
HTTP Modules : Default Installation
Web Host Script Mappings : Default Installation
Following is the output for ServiceModelReg.exe -lv
Microsoft(R) Windows Communication Foundation Installation Utility
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Installed versions of Machine.config Section Groups and Handlers:
system.serviceModel : 3.0.0.0
system.runtime.serialization : 3.0.0.0
system.serviceModel.activation : 3.0.0.0
Installed versions of System.Web Build Provider:
3.0.0.0
Installed versions of System.Web Compilation Assemblies:
System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKe
yToken=b77a5c561934e089, processorArchitecture=MSIL
System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b
77a5c561934e089, processorArchitecture=MSIL
System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b7
7a5c561934e089
Installed versions of HTTP Handlers:
*.svc : 3.0.0.0
Installed versions of HTTP Modules:
ServiceModel : 3.0.0.0
Installed versions of Web Host Script Mappings:
.svc,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GE
T,HEAD,POST,DEBUG
Expecting your reply!!!
Thanks,
Antony -
Wednesday, July 02, 2008 6:59 AMModerator
Can you please check what is the soap address location in the wsdl file when you got it with localhost?
<wsdlervice name="SimpleService">
<wsdlort name="BasicHttpBinding_ISimpleContract" binding="tns:BasicHttpBinding_ISimpleContract">
<soap:address location="http://mycomputer.private.mydomain.com/simple/Simple.svc" />
</wsdlort>
</wsdlervice>
-
Wednesday, July 02, 2008 12:58 PM
I finally got this working after a day and it really is a simple fix. I don't have an SSL on my site and my WCF services are in a virutal directory. Go onto the server and into IIS. Right click on the website that is hosting the serveics and goto properties. On the website tab next to the IP of the site click advancded. In the host header for the site highlight it and click edit. In the host header value enter www.DOMAINNAME.com where domain name is the name of your site. After that open a command prompt and enter "iisrestart". The location values should show up correctly after this is done.
-
Wednesday, July 02, 2008 6:55 PM
Hi,
I have got soap address as a machinename.private.mydomain.com in the Soap address.
please refer the following...
<wsdl
ervice name="MyService">
<wsdl
ort name="BasicHttpBinding_IMyService" binding="tns:BasicHttpBinding_IMyService">
<soap:address location="http://machinename.private.mydomain.com/Sample/Service.svc" />
</wsdl
ort>
</wsdl
ervice>
Thanks for your help,
Antony -
Wednesday, July 02, 2008 7:03 PM
Hi,
Thanks fo your help.
If I change the host header value to mysystem.mydomain.com , and after restart of IIS,
I am not able to open the project in the visual studio 2005. I am getting following error:
"Unable to open the Web ‘http://localhost’. The Web server does not appear to have the FrontPage server extensions installed."
Then I opened the SDK command propmt, and run the following command.
aspnet_regiis -i -enable
Now also i am getting same error.
Any Help pls?
Thanks,
Antony -
Wednesday, July 02, 2008 7:51 PMModerator
If the URL with your static IP on the "localhost" place works that means you have problem with DNS.The easiest way is to edit <Win>\System32\Drivers\Etc\host filrAdd a line like:11.12.12.12 MachineName.DomainName.comwhere 11.12.12.12 - change to your localhost IP- Proposed As Answer by vodovoz Tuesday, September 08, 2009 10:02 PM
-
Tuesday, September 08, 2009 10:05 PMThanks. I was experiencing a similar issue and your suggestion was what fixed the problem.

