当我使用 .svc-ASP.Net 4 服务将我的网站从 Windows Server 2008 复制到 Windows Server 2012 时,Silverlight 应用程序触发的每个 .svc-Request 都会收到 405 响应。
在 Windows Server 2008 中,一切都运行良好。
我尝试了 aspnet_regiis 和 WCF Register (ServiceModelReg)。.svc 文件也包含在 IIS 8 的模块映射中。我还卸载了 ASP.NET 4.5+3.5 并重新安装了它和 WCF HTTP 托管。
所有网站都受到此迁移的影响。
要求:
POST /Data/search.svc HTTP/1.1
Accept */*
回复:
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS, TRACE
文件如下所示,我还尝试添加“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);
}
}
感谢您的任何提示。