简体   繁体   English

IIS似乎无法验证我的请求

[英]IIS appears to not be authenticating my request

Okay so full disclosure I am new to IIS and WCF so I bought a book and am stuck. 好吧,全面披露我对IIS和WCF还是陌生的,所以我买了一本书,被困住了。 I can develop on my dev box at work as it is Windows 7 with IIS 7 but at home on Windows 8 and IIS 8 I believe there are two issues and I just do not know which step is potentially causing the issue. 我可以在工作中使用开发盒进行开发,因为它是带有IIS 7的Windows 7,但在Windows 8和IIS 8上却可以在家里使用,我相信有两个问题,我只是不知道哪个步骤可能会导致此问题。 I am developing on .NET 4.5 environment with Visual Studio 2012 Professional for both environments. 我正在使用Visual Studio 2012 Professional在两种环境下在.NET 4.5环境中进行开发。

Basically I believe IIS to be set up wrong as I am following a book called 'Windows Communication Foundation 4, Step be Step' http://www.amazon.com/Windows-Communication-Foundation-Step-Microsoft/dp/0735645566 基本上,我相信IIS设置错误,因为我正在遵循一本名为“ Windows Communication Foundation 4,请循序渐进”的书http://www.amazon.com/Windows-Communication-Foundation-Step-Microsoft/dp/0735645566

I followed the set up instructions but they are a little different at home and am curious what to do to correct this error: 我按照设置说明进行操作,但是它们在家里有些不同,并且很好奇该如何纠正此错误:

"The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: ' " “响应消息的内容类型text / html; charset = utf-8与绑定的内容类型不匹配(text / xml; charset = utf-8)。如果使用自定义编码器,请确保IsContentTypeSupported方法已正确实施。响应的前1024个字节为:“

This code occurs after I create a WCF service library web project, it is referencing an entity framework model. 在创建WCF服务库Web项目之后,此代码发生,它引用了实体框架模型。 You create a console app that references the web service and it runs fine. 您创建引用Web服务的控制台应用程序,并且该应用程序运行良好。 You deploy that web service to IIS and change the config file to reference that location and it blows up with the error above ONLY on the windows 8 machine, the Windows 7 runs just fine. 您将该Web服务部署到IIS并更改配置文件以引用该位置,并且该错误仅在Windows 8计算机上出现上述错误,Windows 7运行良好。

I noticed two steps I could not do in the setup and believe they are the culprits but don't know how to adjust for Windows 8 yet. 我注意到我无法在设置中执行两个步骤,并认为它们是罪魁祸首,但还不知道如何针对Windows 8进行调整。

  1. From VS command prompt: 'aspnet_regiis -iru', this does not work AT ALL for IIS 8. Don't know what options when you open IIS to set for the generic okays for asp.net operations. 从VS命令提示符:“ aspnet_regiis -iru”,这对于IIS 8根本不起作用。不知道打开IIS为asp.net操作的通用设置设置哪些选项。 - I did attempt to go into IIS and under 'Authentication' turn on Anonymous authentication and ASP.NET. -我确实尝试进入IIS,并在“身份验证”下启用匿名身份验证和ASP.NET。 Still did not fix anything. 仍然没有解决任何问题。

  2. The book came with a sql object that then registered two users to the database for 'Adventureworks'. 本书附带一个sql对象,该对象随后将两个用户注册到“ Adventureworks”数据库中。 Obviously I am guessing since part 1 did not work or due to Windows 8 settings these users do not exist, hence they cannot be registered. 显然我在猜测,因为第1部分不起作用,或者由于Windows 8设置,这些用户不存在,因此无法注册。 The code for the register users is: 注册用户的代码为:

'CREATE USER [IIS APPPOOL\\DefaultAppPool] FOR LOGIN [IIS APPPOOL\\DefaultAppPool] GO EXEC sp_addrolemember N'db_owner', [IIS APPPOOL\\DefaultAppPool] GO GO CREATE USER [IIS APPPOOL\\ASP.NET v4.0] FOR LOGIN [IIS APPPOOL\\ASP.NET v4.0] GO EXEC sp_addrolemember N'db_owner', [IIS APPPOOL\\ASP.NET v4.0] GO' '创建用户[IIS APPPOOL \\ DefaultAppPool]登录[IIS APPPOOL \\ DefaultAppPool] GO EXEC sp_addrolemember N'db_owner',[IIS APPPOOL \\ DefaultAppPool] GO创建用户[IIS APPPOOL \\ ASP.NET v4.0]登录[IIS APPPOOL \\ ASP.NET v4.0]执行EX sp_addrolemember N'db_owner',[IIS APPPOOL \\ ASP.NET v4.0] GO'

  • I know SQL code but I know that the users don't exist they are trying to reference so may I add them through IIS or through Control Panel? 我知道SQL代码,但是我知道用户不存在,他们正在尝试引用,因此我可以通过IIS还是通过控制面板添加它们? I was not sure so I did not know IIS so thought I should ask first. 我不确定,所以我不了解IIS,以为我应该先问一下。

Any help is much appreciated as I know this is probably just a simple method. 非常感谢任何帮助,因为我知道这可能只是一种简单的方法。

Okay I think I got it but not the way I would have hoped to. 好吧,我想我明白了,但是我却没有做到。 It seems that I need to run the service with Anonymous Access in IIS 8. Go to 'Authentication' under the default site 'disable' ASP.NET impersonation. 看来我需要在IIS 8中使用匿名访问来运行该服务。转到默认站点“禁用” ASP.NET模拟下的“身份验证”。 But.... for some reason IIS8 and WCF options for .NET 4.5 were not enabled by default for Windows 8. So I found this: http://proq.blogspot.com/2012/09/wcf-on-iis-and-windows-8.html and enabled them. 但是...由于某种原因,Windows 8默认未启用.NET 4.5的IIS8和WCF选项。因此,我发现了这一点: http : //proq.blogspot.com/2012/09/wcf-on-iis- and-windows-8.html并启用它们。

Weird, anyways I know at some point I am going to have to register ASP.NET users on my local machine mimicking a server environment. 很奇怪,无论如何,我知道在某个时候我将不得不在模仿服务器环境的本地计算机上注册ASP.NET用户。 But for the time being anonymous access seems to work. 但是暂时匿名访问似乎有效。 I am curious though if IIS knew it had two choices and anonymous was first why it failed? 我很好奇,但是如果IIS知道它有两种选择,而匿名是为什么它失败了? Does it take the most restrictive policy as the default for an access point binding at all times? 是否始终将限制性最强的策略作为接入点绑定的默认策略? I am completely new to IIS and it seems like I am going to have to learn it as well as the WCF. 我对IIS完全陌生,似乎我将不得不学习它以及WCF。

EDIT: When running VS 2012 with some settings also be sure to run VS as ADMINISTRATOR or you may also have issues. 编辑:使用某些设置运行VS 2012时,还请确保以管理员身份运行VS,否则您可能也会遇到问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM