在Windows Server 2012与响应和QUOT .SVC文件; 405不允许的方法" [英] .svc files in Windows Server 2012 respond with "405 Method not Allowed"

查看:513
本文介绍了在Windows Server 2012与响应和QUOT .SVC文件; 405不允许的方法"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我复制使用.SVC-ASP.Net 4服务从Windows Server 2008到Windows Server 2012我的网站,我得到每.SVC请求405响应由Silverlight应用程序被触发。

When I copied my Websites using .svc-ASP.Net 4 Services from Windows Server 2008 to Windows Server 2012, I get a 405 Response for every .svc-Request being triggered by a Silverlight application.

在Windows Server 2008中的一切完美。

In Windows Server 2008 everything worked perfectly.

我试过为aspnet_regiis和WCF寄存器(ServiceModelReg)。该文件的.svc也纳入模块映射在IIS 8.我还卸载了ASP.NET 4.5 + 3.5并重新安装它和WCF HTTP主机。

I tried aspnet_regiis and the WCF Register (ServiceModelReg). The file .svc is also included into the Module Mappings in IIS 8. I also uninstalled ASP.NET 4.5+3.5 and reinstalled it and the WCF HTTP Hosting.

所有的网站都受此影响迁移。

All Websites are affected by this migration.

请求:

POST /Data/search.svc HTTP/1.1
Accept  */*

响应:

HTTP/1.1 405 Method Not Allowed
Allow:  GET, HEAD, OPTIONS, TRACE

该文件看起来如下方式,我也尝试添加WebInvoke。

The files look the following way, I also tried to add 'WebInvoke'.

[ServiceContract]
public interface IPackages
{
    /// <summary>
    /// Gets a package by a public key
    /// </summary>
    /// <param name="publicKey">Used public key</param>
    /// <returns>Information about the package</returns>
    [OperationContract]
    PackageInformation GetPackageByPublicKey(string publicKey);

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Packages" in code, svc and config file together.
public class Packages : IPackages
{
    /// <summary>
    /// Gets a package by a public key
    /// </summary>
    /// <param name="publicKey">Used public key</param>
    /// <returns>Information about the package</returns>
    public PackageInformation GetPackageByPublicKey(string publicKey)
    {
            return packageManager.GetPackageByPublicKey(publicKey);
    }
}

感谢您的任何提示。

Thanks for any hint.

推荐答案

在Windows 2012,你需要去服务器管理器,然后添加角色和功能。点击下一步几次,直到你到了服务器角色选项。从那里,展开应用程序服务器,然后选择Web服务器(IIS)支持。接下来,您需要选择HTTP Activiation,也许TCP激活(我做了两个),这是2012年实现对WCF支持

On Windows 2012 you need to go to Server manager, then Add Roles and Features. Click next a couple of times till you get to the Server Roles options. From there, expand Application Server and select "Web Server (IIS) Support". Next you need to select Http Activiation and maybe TCP Activation (I did both), this is what enables support for WCF on 2012.

应该选择所有必要的依赖你,但它可能是你还需要转到Web服务器(IIS)部分,然后在应用程序开发,然后选择您需要的ASP.NET选项(我已经先安装这些选项,所以我不知道是否有必要做这个还是不只要做支持选项)。这将创建.SVC处理你。

It should select all necessary dependencies for you, but it might be that you also need to go to the "Web Server (IIS)" section, then "Application Development" and select the ASP.NET option that you need (I had already installed these options first, so I don't know if it's necessary to do this or not if only doing the Support option). This will create the .svc handler for you.

这篇关于在Windows Server 2012与响应和QUOT .SVC文件; 405不允许的方法&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆