Why doesn’t my WCF service provide metadata locally, when I think I have set it up exactly as it is in the test environment?
Environment
My development machine has Windows Server 2003, SP2 with IIS. I have built my service locally and then set up the CSPROJ’s directory as a Web site.
IIS Configuration
Web Site Description MyService
IP Address (All Unassigned)
TCP port 5001
Enable HTTP Keep-Alives true
HomeDirectory Directory located on this computer
Local Path Project directory with .svc and Web.config
Application Name Default Application
Execute Permissions Scripts and Executables
Application Pool Default
ASP.NET Version 2.0.50727
Virtual Path MyService
File location Path of Web.config
I modeled my IIS settings on a UAT instance that I can get proxy information from.
However when I try to get proxy information on my instance with
C:\Program Files\Microsoft Visual Studio 10.0\VC>svcutil http://localhost:5001/P
mdgService.svc
I get the following error messages.
Error: Cannot obtain Metadata from
http://localhost:5001/MyService.svc
…Metadata contains a reference that cannot be resolved:
‘http://localhost:5001/MyService.svc‘.There was no endpoint listening at http://localhost:5001/MyService.svc
…
The remote server returned an error: (404) Not Found.
…
I cannot browse to the URL.
I have tried suggestions
- Verified that metadata behavior is used. (It’s identical to working instances.)
- Allowing full control access to C:\Windows\temp to IWAM_, IUSER_, ASPNET (suggested here: WCF Metadata reference cannot be resolved) did not help.
Here is a look at my Web.config
<configuration>
<!-...-->
<system.serviceModel>
<services>
<service behaviorConfiguration="MyService.Service1Behavior" name="MyService.MyService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"
contract="MyService.MyService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647"
maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
The problem was that of permissions.
Once I granted these permissions to NETWORK SERVICE on the machine, I was able to create proxies and configure that service in my Silverlight client.
I would like to thank razlebe for pointing me in the right direction.