86565656 发表于 2015-11-14 15:30:48

.net 4.0中wcf在iis7中的配置过程

  我的环境是:windows server 2008 datacenter + IIS7.0 + VS2010 RC
  我用的是ms提供的sample,使用其提供的bat文件来设置环境的:bat内容如下:
  @echo off
iisreset /stop
mkdir %SystemDrive%/inetpub/wwwroot/ServiceModelSamples/bin
VER | FINDSTR /c:" 6.0." >NUL
IF NOT ERRORLEVEL 1 (
    IF EXIST %windir%/system32/inetsrv/appcmd.exe (
      %windir%/system32/inetsrv/appcmd.exe add app /site.name:"Default Web Site" /path:/ServiceModelSamples /physicalPath:%systemdrive%/inetpub/wwwroot/ServiceModelSamples
    ) ELSE (
      Echo "Could not find %windir%/system32/inetsrv/appcmd.exe.Please ensure IIS is installed.See 'Internet Information Service (IIS) Hosting Instructions' in the WCF samples Setup Instructions."
    )
) ELSE (
    IF EXIST %SystemDrive%/inetpub/adminscripts/adsutil.vbs (
      cscript.exe %SystemDrive%/inetpub/adminscripts/adsutil.vbs CREATE w3svc/1/root/ServiceModelSamples "IIsWebVirtualDir"
      cscript.exe %SystemDrive%/inetpub/adminscripts/adsutil.vbs SET w3svc/1/root/ServiceModelSamples/Path %SystemDrive%/inetpub/wwwroot/ServiceModelSamples
      cscript.exe %SystemDrive%/inetpub/adminscripts/adsutil.vbs SET w3svc/1/root/ServiceModelSamples/AppRoot "w3svc/1/Root/ServiceModelSamples"
      cscript.exe %SystemDrive%/inetpub/adminscripts/adsutil.vbs APPCREATEPOOLPROC w3svc/1/root/ServiceModelSamples
    ) ELSE (
      Echo "Could not find %SystemDrive%/inetpub/adminscripts/adsutil.vbs.Please ensure IIS is installed.See 'Internet Information Service (IIS) Hosting Instructions' in the WCF samples Setup Instructions."
    )
   
)
iisreset /start
  
  但是配置完成后,再浏览器中打开地址时却出现如下错误:折腾了好久,还是没搞定,如果有熟悉的请指教。
  

  
  解决方法:
  安装.Net FrameWork 3.5及其sp1
  然后安装IIS7.0功能,相关功能如下图:

  
             版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: .net 4.0中wcf在iis7中的配置过程