我在看《WCF揭密》书,刚开始做例子就出现问题。看到国外文章中列出了书中的错误,这里翻译一下。为我也为别人提供帮助。
Windows Communication Foundation 3.5 Unleashed Errors
WCF 3.5 揭密书中错误
I am reading this book; it is very well written, and the people who wrote it are obviously very smart.
我正在读这本书,写得非常好,但作者显然很聪明。
Unfortunately, it is chock full of technical errors. I have wasted hours trying to get the examples to work.
很不幸,书中布满了技术错误。我花费许多时间尝试让例子正常运行。
In the hope of saving others some time, I am listing a few of the problems I found.
为了节省他人的时间,我列出了一些我发现的错误。
In addition to these, there are lots of other errors I found in my first, casual, reading, especially in the code.
除了这些以外,我发现大量其它马虎、阅读、特别在代码中的错误。
In the Fundamentals chapter (2),Page 45, step 1: add the app.config file to the Host project, NOT the DerivativesCalculatorService project (see page 53)
在第二章,基础45页,步骤1,增加app.config文件到Host项目,而不是增加到DerivativesCalculatorService项目中。出错的错误如下。
error: Service ‘DerivativesCalculator.DerivativesCalculatorServiceType’ has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
Page 56, step 4: there should not be a colon before “svcutil” (and there is not in the screenshot below)
56页,第四步,不应该在svcutil前加冒号(并且书中下边的载图中并不包含)
Page 58: The class should be DerivativesCalculatorClient rather than DerivativesCalculatorProxy (since that is the class created by the tool — see listing 2.6)
58页,应该是DerivativesCalculatorClient类,而不是DerivativesCalculatorProxy。
Page 67 – 72: Getting the service to run under IIS 7.0 required quite a number of additional steps, at least in my configuration.
67-72页,我的配置中,在IIS7下得到服务让其运行,至少要求许多其它步骤。
1) — Page 69, Step 3 – Must use Add Application rather than Add Virtual Directory, at least in IIS 7.0 . I wasted quite a bit of time on this one, until I found http://social.msdn.microsoft.com/forums/en-US/wcf/thread/49d9279f-2bc1-482b-8bb0-da1261736acb/ , where this exact problem with this exact same example was noted in April 2006.
error: The type ‘DerivativesCalculatorService.Calculator’, provided as the Service attribute value in the ServiceHost directive could not be found.
2) — Need to give the IIS_IUSRS permission to the DerivitivesCalculatorService directory, so IIS can use the config file
3) — Need to give the Anonamous Login user permission to the DeriviativesCalculatorService directory, so IIS will serve it to the user
4) — I had to fix the bindings to the .svc extension using
c:\windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg -r
It is possible that I had that problem because I enabled IIS after I had already installed VisualStudio. Or not.
5) — I had to turn on the WCF Activation with Control Panel/Programs/Turn Windows Features On/Microsoft .NET 3.0/WCF Activation for http and non-http – see http://michael-arnett.spaces.live.com/blog/cns!5AA848FF3F707F99!1093.entry?
- error: HTTP 500 – Handler svc-Integrated has a bad module “ManagedPipelineHandler” in its module list
Page 75 – in my testing, the MSFT string was NOT encrypted when I used the netTcpBinding
通过我的测试,当我使用netTcpBinding时MSFT 并非加密。
Page 79 – to use the WcfTestClient with this demo, run:
WcfTestClient http://localhost:8000/Derivatives/ or WcfTestClient http://localhost:8000/Derivatives/?wsdl
使用WcfTestClient测试时,运行WcfTestClient,地址http://localhost:8000/Derivatives/或者 WcfTestClient地址http://localhost:8000/Derivatives/?wsdl
注:自己英语水平有限,翻译如果有误,请指教。
原文出处:http://nachbar.name/blog/2009/06/14/windows-communication-foundation-35-unleashed-errors/