惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
I
InfoQ
小众软件
小众软件
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
V
V2EX
G
Google Developers Blog
罗磊的独立博客
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
N
Netflix TechBlog - Medium
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
IT之家
IT之家
J
Java Code Geeks
L
LangChain Blog
D
DataBreaches.Net
F
Fortinet All Blogs
B
Blog
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
P
Privacy & Cybersecurity Law Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
Kaspersky official blog
博客园 - 【当耐特】
T
Tenable Blog
AWS News Blog
AWS News Blog
V
Visual Studio Blog
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
H
Heimdal Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Secure Thoughts
Security Archives - TechRepublic
Security Archives - TechRepublic
I
Intezer
Attack and Defense Labs
Attack and Defense Labs
Webroot Blog
Webroot Blog
Latest news
Latest news
TaoSecurity Blog
TaoSecurity Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Threatpost
SecWiki News
SecWiki News
S
Security Affairs
H
Help Net Security

博客园 - Elaine Shi

笔记《Hbase 权威指南》 读Java 804 - Quick refresher 804 pretest 解题 JAVA SE 803 考试前突击 Hadoop学习笔记之(二):实验Hadoop的文件块复制删除操作感受强大的容灾性 代码笔记:使用C#转移Wordpress博客到为知笔记或Evernote Hadoop准备篇之(一):Page Rank算法初探 Hadoop学习笔记(一):零Linux基础安装hadoop过程笔记 代码笔记:使用Xml2Linq和CodeDom自动重整多语化资源文件 WPF学习笔记(一):启程 网站推荐:这两年收藏的网站和链接 项目过程记录:记一次小小的与美方成功的离岸协作 读潘正磊访谈录 沤血分享之:使用Opera浏览器技巧全集 转一篇前端开发人员总结的《JavaScript 学习资源推荐》 网站推荐:一路收藏的正能量网站 如何实现单词拼写检查 (spellChecker) ? 由Suggestion衍生出来的算法学习 使用简单的反射技术重构组合查询串功能
WCF REST IIS6配置各种伤不起
Elaine Shi · 2013-05-11 · via 博客园 - Elaine Shi

一、IIS6,安装全部包括CGI,ASP,ASP.NET,ISAPI Flters, ISAPI Extension等

二、在IIS中添加一个SITE

1. 按如下图

e5a7bae4dfbf48b836ba741c5fe8ee07

2. 配置权限

f51e68e868c4e3d2fe40c81ffce3f841

46ee2137ed551110a7348b405b5f3cbf

4e4c90f390ca0fd42e57f27cc6f921ac

以上设置会出现以下带下划线的配置

<system.web>

    < compilation debug ="false " targetFramework ="4.0 ">

      < assemblies>

        < add assembly ="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

      </ assemblies>

    </ compilation>

    <!-- 没有这一段,会出现无权限错 -->

<authorization>

      < allow users ="* " />

    </ authorization>

    < authentication mode ="Forms " />

    < profile>

      < properties>

        <!-- todo:研究如何使用M$自带DLL来操作USER类 -->

        < add allowAnonymous ="false " defaultValue ="" name=" UserName" readOnly=" false" serializeAs=" String" type=" System.String" />

      </ properties>

    </ profile>

  </system.web>

fc87bdf35c03af69a04aff2a27ef26b9

3e04d26d281412870b0980b882b30619

如果没有上述MAPPING,则说明WCF没有安装到IIS中,需要运行

1. register ASP.NET runtime from VS.NET 2005/2008 command line run: aspnet_regiis –i –enable
2. map *.svc file by

2.1 Win2003 or XP run: "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r

2.2 Win2008 or Vista run: "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -L

(如果是64位,要选择64位的,反正我现在是这么选择的)

3. then restart your IIS  iisreset /noforce

注意appPool的设置须为integrated,否则会出现ISAPI and CGI Restriction的错误(不知道为什么我怎么安装都没这一项显示,WIN7环境?)

db04d45451bd3f0436fb4141fb0c18eb

三、各种TROUBLESHOOTING啊,

WCF ASP.NET (405) Method Not Allowed

请看这一段

http://social.msdn.microsoft.com/Forums/br/wcf/thread/31d3f1aa-28b6-4bd7-b031-73b7e7588e6d

Hi,
    Normally, 405 error code is because two reasons;
1) ASP.NET is not installed or register to your IIS
2) The *.svc file type is not mapped to the aspnet_isapi.dll
to solve problem:
1. register ASP.NET runtime from VS.NET 2005/2008 command line run: aspnet_regiis –i –enable

  %SystemRoot%\Microsoft.NET\Framework64\v4.0.30128\aspnet_regiis.exe -iru


2. map *.svc file by

2.1 Win2003 or XP run: "%WINDIR%\Microsoft     .Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r

(如果是64位,要选择64位的,反正我现在是这么选择的)

2.2 Win2008 or Vista run: "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -L

3. then restart your IIS  iisreset /noforce
Hope this helps,
-Jirapong

753d57d34c96573154db5531b94d8ab8

首先在

ASP.NET 4.0 无法加载 System.ServiceModel.Activation.HttpModule

"Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'"

This error can occur when IIS is installed after installing .NET Framework 4, or if the 3.0 version of the WCF Http Activation module is installed after installing IIS and .NET Framework 4.

To resolve this problem, you must use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe,) to register the correct version of ASP.NET. This can be accomplished by using the –iru parameters when running aspnet_regiis.exe as follows:

aspnet_regiis.exe -iru

三、WCF在WEB.CONFIG中serviceModel节点的配置

5220ef5ea721693728a93dc1467d448f

使WCF能支持ASP SESSION等的配置:aspNetCompatibilityEnabled = "true "

<serviceHostingEnvironment multipleSiteBindingsEnabled=" true" aspNetCompatibilityEnabled ="true ">

只有加了webHttpBinding才能在网页中调用(比如ajax)

<endpoint address="" binding= "webHttpBinding"

这一条元数据交换是必备的

<endpoint address=" mex" binding=" mexHttpBinding" contract=" IMetadataExchange" />

endpoint也是要设置的,这个是指的wcf server host在IIS中的配置

<host>

   < baseAddresses>

      < add baseAddress ="http://localhost:8080/QuestionnaireService.svc " />

   </ baseAddresses>

</ host>

Behavior中定义了WCF服务的行为模式,比如需要禁用GET访问,则HttpGetEnabled = false

maxReceivedMessageSize 过小会使得接收的JSON串过大时出错

receiveTimeout 也需要改动为合适的值

直接RUN(DEBUG模式)WCF项目后,会自动触发wcfTestClient.exe工具,但改回到默认为webHttpBinding后,就木有了= 。- 要研究一下

C#

[ServiceBehavior(Name = "QuestionnaireService",

        InstanceContextMode = InstanceContextMode.PerSession,

        ConcurrencyMode = ConcurrencyMode.Single)]

public class QuestionnaireService : IQuestionnaireService

    {

        [ WebInvoke(UriTemplate="GetQuestionnaireData" )]

        [ ScriptMethod(UseHttpGet = false , ResponseFormat = ResponseFormat.Json)]

public string GetQuestionnaireData(string id)

        {

            serviceInit();

XMLQuestionnaire qn = new Questionnaire.Lib.Entities.Questionnaire ().Get(id.ToInt()).QuestionnaireDTO;

//清除不需要用在界面上的元素,减少RESPONSE大小

            qn.categories = null;

return qn.ToJSON();

        }

如果出现这个问题,AppPool没有设置成4.0

85c8ab466c6f9dbf0c0efc30e58acff7

如果这个菜单不出现

0f6c6e88895a66d24c65fd736c993105

那就再加一个WCF SERVICE进去