Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 即使在web.config中注册,也找不到JSONP webservice的终结点_Asp.net_Vb.net_Wcf_Web Services_Jsonp - Fatal编程技术网

Asp.net 即使在web.config中注册,也找不到JSONP webservice的终结点

Asp.net 即使在web.config中注册,也找不到JSONP webservice的终结点,asp.net,vb.net,wcf,web-services,jsonp,Asp.net,Vb.net,Wcf,Web Services,Jsonp,我刚刚添加了一个新的Web服务,但当我接近它时,我得到:未找到端点。 关于URLhttp://www.testsite.com/service.svc/getcompanyreviewdetails/?id=315&t=1 我有另一个可以找到端点的服务: http://www.testsite.com/service.svc/getshopitems/?newurl=myurl 当我请求http://www.testsite.com/service.svc?wsdl,我也没有看到该列表中的get

我刚刚添加了一个新的Web服务,但当我接近它时,我得到:
未找到端点。
关于URL
http://www.testsite.com/service.svc/getcompanyreviewdetails/?id=315&t=1

我有另一个可以找到端点的服务:
http://www.testsite.com/service.svc/getshopitems/?newurl=myurl

当我请求
http://www.testsite.com/service.svc?wsdl
,我也没有看到该列表中的
getcompanyreviewdetails
方法

这是我的密码:

Iservice.vb

Namespace RestService

    <ServiceContract()>
    Public Interface Icompanyservice

        <OperationContract()> _
<Web.WebInvoke(Method:="GET", ResponseFormat:=Web.WebMessageFormat.Json, BodyStyle:=Web.WebMessageBodyStyle.Bare, _
UriTemplate:="getcompanyreviewdetails/?id={id}&t={t}")> _
        Function getCompanyReviewDetails(ByVal id As Integer, ByVal t As Integer) As Stream
    End Interface

    <ServiceContract()>
    Public Interface Iservice
            <OperationContract()> _
    <Web.WebInvoke(Method:="GET", ResponseFormat:=Web.WebMessageFormat.Json, BodyStyle:=Web.WebMessageBodyStyle.Bare, _
    UriTemplate:="getshopitems/?newurl={newurl}")> _
            Function getShopItems(ByVal newURL As String) As Stream
    End Interface

End Namespace
Namespace RestService

<ServiceContract(Namespace:="RestService")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
Public Class companyservice
    Implements Icompanyservice

         Public Function getCompanyReviewDetails(ByVal id As Integer, ByVal t As Integer) As Stream Implements Icompanyservice.getCompanyReviewDetails
         End Function

    End Class

    <AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
    Public Class service
        Implements Iservice 

        Public Function getShopItems(ByVal newURL As String) As Stream Implements Iservice.getShopItems
        End Function

    End Class

End Namespace   

然后这两个服务都可以工作,但是如何验证服务
getcompanyreviewdetails
现在是否是JSONP而不是JSON?

Example.svc.vb
没有接口

<ServiceContract(Namespace:="{namespace the service resides in}")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class ExampleService


示例.svc.vb无接口

<ServiceContract(Namespace:="{namespace the service resides in}")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class ExampleService


如果将getCompanyReviewDetails更改为作为流端接口的函数getCompanyReviewDetails(ByVal id为整数,ByVal t为整数),而不是operationcontract,则会发生什么情况,我得到了设计时错误
属性“ServiceContractAttribute”无法应用于“getCompanyReviewDetails”,因为该属性在此声明类型上无效。
如果更改为函数时getCompanyReviewDetails的Servicecontract而不是operationcontract,会发生什么情况getCompanyReviewDetails(ByVal id为整数,ByVal t为整数)作为流端接口,我得到的设计时错误
属性“ServiceContractAttribute”无法应用于“getCompanyReviewDetails”,因为该属性在此声明类型上无效。
我已将
添加到weddingservice.svc.vb文件中,但基于您的示例,我不确定在我的web.config文件中放置什么。我应该为属性
绑定
绑定配置
合同
名称
提供哪些值?感谢您在
元素中定义名称,然后在
元素中使用该名称。我添加了
,并为
绑定
属性添加了
webHttpBindingWithJsonP
,但是其他属性呢?
name
属性是否与
Binding
名称匹配,
Binding
属性是否与绑定类型匹配?我已将
添加到weddingservice.svc.vb文件中,但根据您的示例,我不确定在我的web.config文件中放置什么。我应该为属性
绑定
绑定配置
合同
名称
提供哪些值?感谢您在
元素中定义名称,然后在
元素中使用该名称。我添加了
,并为
绑定
属性添加了
webHttpBindingWithJsonP
,但是其他属性呢?
name
属性是否与
Binding
名称匹配,
Binding
属性是否与绑定类型匹配?
<client />
<services>
  <service name="RestService.service">
    <endpoint behaviorConfiguration="webHttp" binding="webHttpBinding" contract="RestService.Iservice" />
    <endpoint address="http://www.testsite.com/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RestService.Icompanyservice" />
  </service>
</services>
  <service name="RestService.service">
    <endpoint behaviorConfiguration="webHttp" binding="webHttpBinding" contract="RestService.Iservice" />
    <endpoint address="http://www.testsite.com/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RestService.Iservice" />
  </service>
<endpoint address="/service.svc" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RestService.Iservice" />
<ServiceContract(Namespace:="{namespace the service resides in}")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class ExampleService
<endpoint address="http://{your domain}/ExampleService.svc"
 binding="customBinding" bindingConfiguration="CustomBinding_ExampleService"
 contract="ExampleServRef.ExampleService" name="CustomBinding_ExampleService" />

<endpoint address="http://{localhost:port}/ExampleService.svc"
 binding="customBinding" bindingConfiguration="CustomBinding_ExampleService"
 contract="ExampleServRef.ExampleService" name="CustomBinding_ExampleService" />