在http://localhost:3331/Service1.svc上没有侦听端点 [英] There was no endpoint listening at http://localhost:3331/Service1.svc

查看:84
本文介绍了在http://localhost:3331/Service1.svc上没有侦听端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我开发了一个Web应用程序和wcf服务.我添加了对Web应用程序的wcf引用.执行项目后,它显示类似
的错误

在http://localhost:3331/Service1.svc上没有侦听终结点的端点可以接受该消息.这通常是由不正确的地址或SOAP操作引起的.有关更多详细信息,请参见InnerException(如果存在).

请给我任何建议...

这是WCF客户端项目上的web.config:

<!-
有关如何配置ASP.NET应用程序的更多信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
->
< configuration>
< connectionstrings>
< add name ="ApplicationServices" connectionstring =数据源=.\ SQLEXPRESS;集成安全性= SSPI; AttachDBFilename = | DataDirectory | \ aspnetdb.mdf; User Instance = true" providername ="System.Data.SqlClient">
< add name ="FirstGuardianConnectionString" connectionstring ="Data Source = SYSTEM1; Initial Catalog = FirstGuardian; User ID = sa" providername ="System.Data.SqlClient">

< system.web>
< compilation debug ="true" targetframework ="4.0">
<装配体>
< add assembly ="System.Data.Linq,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = B77A5C561934E089">


< authentication mode =表单">
< forms loginUrl =〜/Account/Login.aspx" timeout ="2880"/>

<成员身份>
< providers>
< clear>
< add name ="AspNetSqlMembershipProvider" type ="System.Web.Security.SqlMembershipProvider" connectionstringname ="ApplicationServices" enablepasswordretrieval ="false" enablepasswordreset ="true" requirequestionandanswer ="false" requireduniqueemail ="false" maxinvalidpasswordattempts ="5" ="6" minrequirednonalphanumericcharacters ="0" passwordattemptwindow ="10" applicationname ="/">


< profile>
< providers>
< clear>
< add name ="AspNetSqlProfileProvider" type ="System.Web.Profile.SqlProfileProvider" connectionstringname ="ApplicationServices" applicationname ="/">


< rolemanager enabled ="false">
< providers>
< clear>
< add name ="AspNetSqlRoleProvider" type ="System.Web.Security.SqlRoleProvider" connectionstringname ="ApplicationServices" applicationname ="/">
< add name ="AspNetWindowsTokenRoleProvider" type ="System.Web.Security.WindowsTokenRoleProvider" applicationname ="/">



< system.net>
< connectionmanagement>
< add maxconnection ="200" address ="*">


< system.webserver>
< modules runallmanagedmodulesforallrequests ="true">

< system.servicemodel>
< bindings>
< wshttpbinding>
< binding name ="WSHttpBinding_IService1" closetimeout ="00:01:00">
openTimeout ="00:01:00" receiveTimeout ="00:10:00" sendTimeout ="00:01:00"
绕过ProxyProxyOnLocal ="false" transactionFlow ="false" hostNameComparisonMode ="StrongWildcard"
maxBufferPoolSize ="524288" maxReceivedMessageSize ="65536" messageEncoding =文本"
textEncoding ="utf-8" useDefaultWebProxy ="true" allowCookies ="false">
< readerquotas maxdepth ="32" maxstringcontentlength ="8192" maxarraylength ="16384">
maxBytesPerRead ="4096" maxNameTableCharCount ="16384"/>
< reliablesessionordered ="true" inactivitytimeout ="00:10:00">
enabled ="false"/>
<安全模式=消息">
< transport clientcredentialtype ="Windows" proxycredentialtype ="None"> realm ="/>
< message clientcredentialtype ="Windows" negotiationservicecredential ="true">
algorithmSuite =默认"/>




< client>
<端点地址="http://localhost:3331/Service1.svc" binding ="wsHttpBinding">
bindingConfiguration ="WSHttpBinding_IService1" contract ="ServiceReference1.IService1"
name ="WSHttpBinding_IService1">
< identity>
< dns value ="localhost">



<行为>
< servicebehaviors>
<行为名称=">
< servicemetadata httpgetenabled ="true">
< servicedebug includeexceptiondetailinfaults ="false">



< servicehostingenvironment Multiplesitebindingsenabled ="true">



这是WCF服务上的web.config:

< configuration>
< appsettings>
< connectionstrings>
< add name ="FirstGuardianConnectionString" connectionstring ="Data Source = SYSTEM1; Initial Catalog = FirstGuardian; User ID = sa" providername ="System.Data.SqlClient">

< system.web>
< compilation debug ="true" targetframework ="4.0">
<!-
< authentication>部分启用配置

使用的安全认证模式的说明 ASP.NET识别传入的用户.
->
< authentication mode ="Windows">
<!-
< customerrors>部分启用配置
/发生未处理的错误时该怎么办
在执行请求期间.具体来说,
它使开发人员可以配置html错误页面
将显示以代替错误堆栈跟踪.

< customerrors mode ="RemoteOnly" defaultredirect ="GenericErrorPage.htm">
<错误statuscode ="403" redirect ="NoAccess.htm">
<错误statuscode ="404" redirect ="FileNotFound.htm">

->
< pages controlrenderingcompatibilityversion ="3.5" clientidmode ="AutoID">

<!-
要在Internet下运行ASP.NET AJAX,必须使用system.webServer部分. 信息服务7.0. IIS的早期版本没有必要.
->
< system.servicemodel>
< services>
< service name ="WcfService1.Service1" behaviorconfiguration ="WcfService1.Service1Behavior">
<!-服务端点->
< endpoint address =" binding ="wsHttpBinding" contract ="WcfService1.IService1">
<!-
部署后,应删除或替换以下标识元素以反映
运行已部署服务的身份.如果删除,WCF将推断出适当的身份
自动.
->
< identity>
< dns value ="localhost">


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


<行为>
< servicebehaviors>
< behavior name ="WcfService1.Service1Behavior">
<!-为避免泄露元数据信息,请在部署之前将下面的值设置为false并删除上面的元数据终结点->
< servicemetadata httpgetenabled ="true">
<!-要在故障中接收异常详细信息以进行调试,请将下面的值设置为true.部署前设置为false以避免泄露异常信息->
< servicedebug includeexceptiondetailinfaults ="false">







谢谢与问候,
swathi

Hi,
I developed a web application and wcf services. I added wcf reference to web application.After executing the project,it shows error like,


There was no endpoint listening at http://localhost:3331/Service1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Please give me any suggestions...

This is the web.config on the WCF client project:

<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionstrings>
<add name="ApplicationServices" connectionstring="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providername="System.Data.SqlClient">
<add name="FirstGuardianConnectionString" connectionstring="Data Source=SYSTEM1;Initial Catalog=FirstGuardian;User ID=sa" providername="System.Data.SqlClient">

<system.web>
<compilation debug="true" targetframework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">


<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>

<membership>
<providers>
<clear>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionstringname="ApplicationServices" enablepasswordretrieval="false" enablepasswordreset="true" requiresquestionandanswer="false" requiresuniqueemail="false" maxinvalidpasswordattempts="5" minrequiredpasswordlength="6" minrequirednonalphanumericcharacters="0" passwordattemptwindow="10" applicationname="/">


<profile>
<providers>
<clear>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionstringname="ApplicationServices" applicationname="/">


<rolemanager enabled="false">
<providers>
<clear>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionstringname="ApplicationServices" applicationname="/">
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationname="/">



<system.net>
<connectionmanagement>
<add maxconnection="200" address="*">


<system.webserver>
<modules runallmanagedmodulesforallrequests="true">

<system.servicemodel>
<bindings>
<wshttpbinding>
<binding name="WSHttpBinding_IService1" closetimeout="00:01:00">
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliablesession ordered="true" inactivitytimeout="00:10:00">
enabled="false" />
<security mode="Message">
<transport clientcredentialtype="Windows" proxycredentialtype="None"> realm="" />
<message clientcredentialtype="Windows" negotiateservicecredential="true">
algorithmSuite="Default" />




<client>
<endpoint address="http://localhost:3331/Service1.svc" binding="wsHttpBinding">
bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1"
name="WSHttpBinding_IService1">
<identity>
<dns value="localhost">



<behaviors>
<servicebehaviors>
<behavior name="">
<servicemetadata httpgetenabled="true">
<servicedebug includeexceptiondetailinfaults="false">



<servicehostingenvironment multiplesitebindingsenabled="true">



And here is the web.config on the WCF service:

<configuration>
<appsettings>
<connectionstrings>
<add name="FirstGuardianConnectionString" connectionstring="Data Source=SYSTEM1;Initial Catalog=FirstGuardian;User ID=sa" providername="System.Data.SqlClient">

<system.web>
<compilation debug="true" targetframework="4.0">
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows">
<!--
The <customerrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customerrors mode="RemoteOnly" defaultredirect="GenericErrorPage.htm">
<error statuscode="403" redirect="NoAccess.htm">
<error statuscode="404" redirect="FileNotFound.htm">

-->
<pages controlrenderingcompatibilityversion="3.5" clientidmode="AutoID">

<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.servicemodel>
<services>
<service name="WcfService1.Service1" behaviorconfiguration="WcfService1.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost">


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


<behaviors>
<servicebehaviors>
<behavior name="WcfService1.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<servicemetadata httpgetenabled="true">
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<servicedebug includeexceptiondetailinfaults="false">







Thanks&Regards,
swathi

推荐答案

我无法正确看到您的配置,我了解的是您在客户端具有WSHttp配置,而在服务器上未配置端点(WCF服务)边.在客户端使用纯http绑定,或者在服务器端配置WsHttp绑定的端点.

在这里发生的是,您的客户端被配置为使用WsHttp绑定,并且当它请求具有wshttp绑定的服务器时,它无法在服务器端找到这样的端点.您必须在服务器端添加一个类型为wshttp的终结点.

默认值为http绑定,因此,如果您可以将客户端配置更改为使用http绑定,则它将在不修改服务器配置的情况下起作用.这样可以解决您的问题.

如果不是,那么请在此处(正确地)复制您的配置文件.
如果可以解决问题,请将此解决方案标记为已解决/已修复".
I am not able to see your configuration properly, what i understood is that you have WSHttp configuration at client side and no endpoint configured at server(WCF service) side. Either use plain http binding at client side or configure an endpoint for WsHttp binding at server side.

Here what happens is that your client is configured to use WsHttp binding and when it requests server with wshttp binding, it is not able to find such an end point at server side. You have to add an endpoint at serverside, which is of type wshttp.
Or
The default is http binding so if you can change client configuration to use http binding, then it will work without modifying server configuration. This will solve your problem.

If not, then please copy your config file here(properly).
Please mark this solution as closed/fixed if this solves your problem


请确保在请求服务时您的wcf服务正在运行.
Make sure that your wcf service is running while you are requesting the service.


这篇关于在http://localhost:3331/Service1.svc上没有侦听端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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