问题描述
我在Win7上的IIS7下有一个网站.在.NET 4.0下的Visual Studio 2010中创建了新的WCF服务应用程序.它在ASP.NET开发服务器下工作正常,但是当我将应用程序部署到IIS并尝试通过URL"http://localhost/MySite/Service1.svc"访问它时,出现此错误:
I have a web-site under IIS7 on Win7. Created a new WCF Service Application in Visual Studio 2010 under .NET 4.0. It works fine under ASP.NET Development server, but when I deploy my app to IIS and trying to access it via URL "http://localhost/MySite/Service1.svc" I have this error:
System.Runtime.Remoting.RemotingException: Requested Service not found
如果我只是尝试打开站点文件夹"http://localhost/MySite/",则会出现此错误:
If I''m just trying to open site folder "http://localhost/MySite/" I have this error:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Runtime.Remoting.Channels.Http.HttpChannelHelper.GetObjectUriFromRequestUri(String uri)
at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.CanServiceRequest(HttpContext context)
at System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessRequest(HttpContext context)
此文件夹中也有一个default.aspx,我可以通过直接链接"http://localhost/MySite/default.aspx"成功打开它,但它不会作为默认文档打开.
没有堆栈跟踪,Windows App或系统日志中没有错误.我试图在web.config中启用跟踪-什么都没有.
web.config是:
There is a default.aspx also in this folder and i can open it successfully by direct link "http://localhost/MySite/default.aspx" but it is not opened as default document.
No stack trace, no errors in Windows App or System log. I''ve tried to enable tracing in web.config - nothing.
The web.config is:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
在研究此问题时,我发现甚至在IIS实际启动我的服务之前就发生了错误.我将.svc文件更改为具有"ServiceLost"而不是"ServiceHost"标记,但是错误仍然相同.
我认为错误源在.NET程序集中.但是在哪里?!
While researching this problem I''ve found that error occures even before IIS actually starts my service. I changed my .svc file to have "ServiceLost" instead of "ServiceHost" tag, but error remains the same.
I assume that error source is somewhere in .NET assemblies. But where?!
推荐答案
这篇关于RemotingException:找不到请求的服务错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!