I have a simple wcf service hosted in IIS6, when I launch serviceutil.exe (svcutil.exe http://10.8.50.1:7507/FileReceiver.svc?wsdl)  to create a proxy I get a complex and long error, but the first part of the error tells me

Error: Cannot obtain Metadata from http://10.8.50.1:7507/FileReceiver.svc?wsdl

I lost about half an hour triying to figure out what is wrong. First of all I tried to expose metadata, but this is not possible in IIS6 or at least I got some errors, and nothing works. After half an hour of frustration, I made a supposition, “maybe it is a problem of premission?”. I changed the identity of the worker process to administrator, and magically everything works as expected…

After some searches I discover that the process tries to access the c:WindowsTemp directory during metadata generation, It is related to the fact that WCF internally used some code generation, thus requiring permission to write to the temp directory. This is annoying because there is no clue that it can be a matter of permissions.

Alk.

Tags:

kick it on DotNetKicks.com

2 Responses to “Cannot obtain Metadata from when trying to create references with serviceutil.exe”

  1. …and the way you change the identity IS??

  2. In IIS 7.0 simply open Application Pools, select the application pool related to the web service that host wcf services and go to advanced settings, from there you can find the Identity of the AP and you can change it.