blog community

Welcome to blog community Sign in | Join | Help
in Search

Raimond Brookman

Architecture and .NET Development

Unable to generate a WCF proxy using svcutil but retrieving the wsdl works?

Tags van Technorati: ,

The other day at a client project, we wanted to generate a proxy using svcutil as we'd done many times before.

However, the svcutil kept throwing strange error messages. Amongst them were:

  • Other mime type expected, expected application/soap+msbin1 but got application/soap+xml (HTTP error 415)
  • Could not import namespace <xyz>

As it turned out, the problem was the following: Everything seemed to work because going to the .svc URL and adding ?wsdl produced the desired output.

However, this wsdl does some schema imports, by referencing the svc URL, but this time using ?xsd=xsd0 , ?xsd=xsd1 etc. The strange thing was that these references produced errors (also when referenced by URL via Internet Explorer). This was also the reason that svcutil started throwing errors...

After some more investigation, the culprit became clear. In order to generated the xsd output, the WCF service executes some code generation and dynamically compiles this. (Discovered using the procesmon sysinternals tool). In order to be able to do that, the current Identity (in this case the AppPool Identity of our virtual directory) needs to have the "List Folder / Read Data" permission, which it does not normally have.

All these problems do not occur if you are running your website under the Network Service account, because account in fact does have these rights.

So in the end the trick is to add the additional right on the c:\windows\temp folder for your App Pool Identity to solve the problem.

Interestingly, if you look at the default rights using IIS7 and Vista, there is a default right assigned to the IIS_IUSERS group on the c:\windows\temp directory. Can you guess the additional permission :-) ? Probably MS has run into the same problem and fixed it in Vista and hopefully also in Windows Server 2008. In this case, making your App Pool Identity a member of the IIS_IUSERS group should be sufficient.

[15-2-2008: Fixed typo]

Published Thursday, February 14, 2008 12:19 AM by Raimondb
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Matthieu said:

Thanks a lot for your post!!! I've tried for 4 hours to find the problem. Giving to "Everyone" 'modify' right on the 'c:\windows\temp' directory solved the issue!

February 14, 2008 9:47 AM
 

josd said:

"...problem and fixed it voor Vista.." What's a 'voor'?! ;)

February 14, 2008 10:11 AM
 

Raimondb said:

Typo fixed :-)

February 15, 2008 11:58 PM
 

Weston said:

Thank you.

Thank YOU.

THANK YOU.

THANK YOU!

Life was good. My WCF service was running fine. Until I needed to make a tiny addition to the service. And I could no longer update the web reference in the client.

Spent 5 hours at office to try to understand why. Went home and tried 3 hours to understand why. Googled, googled, tested, ran process explorer, nothing.

Until I hit this page.

Yep. I had changed the account of the app pool so that I could access another app from the service.

After given the rights to the temp dir, all works again.

I'll grab a beer now, and would gladly offer you one too. Or two.

Thanks. Saved me.

April 25, 2008 6:55 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

Subscribe in NewsGator Online

Subscribe in Bloglines

Add to Google


 Visitors since June 2005




Powered by Community Server, by Telligent Systems