使用+ Web服务(SVC)+ C#DLL找不到端点元素名称 [英] Could not find endpoint element name with + Web Service (SVC) + C# DLL

查看:102
本文介绍了使用+ Web服务(SVC)+ C#DLL找不到端点元素名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是Web服务的新手,并且有与Web Service相关的类似问题

我有可以直接调用其Web服务的客户端dll和app.config文件

我已经创建了Win Forms应用程序,将配置文件和dll添加到了引用中.

单击它会访问Web服务并向我返回所需的结果,直到这里工作成功为止
>
问题:

我需要创建一个(测试)类库,可以从WebOrb控制台访问该类库以使其正常工作.

创建了一个新的类库,并添加了该应用程序. config和dll到引用

我从应用程序复制了工作代码,并将其编译为dll(没有错误).

在bin \ debug \中,我得到了3个文件,客户端dll,test.dll(类库)和test.dll.config

当我打开weborbconsole并浏览时,我将所有3个文件都复制到了inetput \ wwwroot \ weborb30 \ bin文件夹

该类,并调用方法我得到此错误


在ServiceModel客户端配置部分中找不到名称为"WSHttpBinding_IUserLoginLogoutService"和合同为"Client.ClientDetails.ServiceContracts.IUserLoginLogoutService"的终结点元素.这可能是因为找不到您的应用程序的配置文件,或者是因为在客户端元素中找不到与该名称匹配的终结点元素.


我的代码

//公共密码

ChannelFactory<'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService> channelFactory = ChannelFactory<'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService>(( " WSHttpBinding_IUserLoginLogoutService" );

channelFactory.Credentials.UserName.UserName = UserName;

channelFactory.Credentials.UserName.Password =密码;

'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService服务= channelFactory.CreateChannel();

'Client.ClientDetails.ServiceContracts.UserLoginLogout.LoginUserResponse响应= service.LoginUser( new 'Client.ClientDetails .ServiceContracts.UserLoginLogout.LoginUserRequest());

personId = response.PersonId;



App.config


<? xml 版本 = " 1.0 " 编码 = " utf-8 " ?>

< 配置 >

< configSections >

</ configSections >

< system.serviceModel >

< 绑定 >

< wsHttpBinding >

< 绑定 名称 = " wsHttpUserNameCredential " > closeTimeout = " 00:01:00 "

openTimeout = " 00:05:00 " receiveTimeout = " 00:10:00 " sendTimeout = " 00:10:00 "

bypassProxyOnLocal = " false " transactionFlow <字体颜色=#0000ff" size = 2> = " false " hostNameComparisonMode = " 强通配符 "

maxBufferPoolSize = " 524288 " maxReceivedMessageSize <字体颜色=#0000ff" size = 2> = " 5000000 " messageEncoding = " 文本 "

textEncoding = " utf-8 " useDefaultWebProxy = " true " allowCookies = ""; false " >

< readerQuotas maxDepth = " 200 " maxStringContentLength = " 1000000 " maxArrayLength = " 50000 "

maxBytesPerRead = " 4096 " maxNameTableCharCount <字体color =#0000ff" size = 2> = " 16384 " />

< reliableSession 订购 = " true " > inactivityTimeout = " 00:10:00 "

已启用 = " false " />

< 安全性 模式 = " 消息 " > >

< 运输 clientCredentialType = " Windows " proxyCredentialType = " "

领域 = "" ; />

< 消息 clientCredentialType = " UserName " > negotiateServiceCredential = " "

algorithmSuite = " 默认 " 建立SecurityContext <字体color =#0000ff" size = 2> = " true " />

</ 安全性 >

</ 绑定 >

</ wsHttpBinding >

</ 绑定 >

< 客户端 >

< 端点 地址 = http://ClientIPAddress/webService/UserLoginLogoutService.svc

绑定 = " wsHttpBinding " bindingConfiguration <字体颜色=#0000ff" size = 2> = " wsHttpUserNameCredential "

合同 = " Client.ClientDetails.ServiceContracts.IUserLoginLogoutService "

名称 = " WSHttpBinding_IUserLoginLogoutService " >

< 身份 >

< 证书 encodedValue = <字体大小= 2>" <字体颜色=" #0000FF"大小= 2> AwAAAAEAAAAUAAAADGGMlzc8Xgq8SHnv7WhbjjJUoewgAAAAAQAAAL0BAAAwggG5MIIBZ6ADAgECAhBL39wu0UkIpEu4bZIMG5gKMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMDcwMjIxMTYwOTE2WhcNMzkxMjMxMjM1OTU5WjAcMRowGAYDVQQDExFXZWJQRE1UZXN0U2VydmVyMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA78gD1vCbjoftBpFhgySkUrlN1v9bHAckEdrgs7z3XOfXQdGye27qa4A0FxQdEcmkvU/FN +米/xJIoiTveaE9xeh3QVcuS1BtZSlDDcVwYfFpODZfSb9GO0rjQ/bOtoAuyNZStpJag2sq4spvNdXSOw1zQwkYjXoFpzpbyiG24n5sCAwEAAaNLMEkwRwYDVR0BBEAwPoAQEuQJLQYdHU8AjWEh3BZkY6EYMBYxFDASBgNVBAMTC1Jvb3QgQWdlbmN5ghAGN2wAqgBkihHPuNSqXDX0MAkGBSsOAwIdBQADQQBGpUxSV2OD40jvBzIODy/GfHNYbsPLZFaeu2VeGRUN5fSnZJh/FRta7f/V8IfuzTtlH0kj6cux/+ CIImioB2 + U " />

</ 身份 >

</ 端点 >

<字体颜色=#0000ff"大小= 2>

</ 客户端 >

</ system.serviceModel >

</ 配置 >

<

如果我删除了application.exe.config,则从应用程序部分得到了相同的错误,由于未找到配置文件,它甚至没有命中Web服务,但是我已经放置了所有引用的dll和classlibrary和classlibrary.dll.cofig在同一路径中

有人可以建议我我要去哪里哪里



谢谢
Srinivas

解决方案

斯里,

您可以发布解决方案吗?

Damir


Hi All,

I am new to the web services and have similiar problem related to the Web Service

I have the client dll and app.config file which can directly call their webservice

I have created the Win Forms app, added config file and the dll to the references

On click it hits the web service and returns me the required results, till here it WORKS FINE

the problem:

i need to create a (test) class library which will be accessed from the WebOrb  console to get it work

created a new classlibrary, added the app.config and the dll to the references

i copied the working code from the application and compiled it into a dll (no errors)

In the bin\debug\ i get 3 files, the client dll, test.dll (class library) and test.dll.config

i copied all the 3 files to the inetput\wwwroot\weborb30\bin folder

when i open the weborbconsole and browse the class, and invoke the method i get this error


Could not find endpoint element with name 'WSHttpBinding_IUserLoginLogoutService' and contract 'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.


My Code

//Common Code

ChannelFactory<'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService> channelFactory = new ChannelFactory<'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService>("WSHttpBinding_IUserLoginLogoutService");

channelFactory.Credentials.UserName.UserName = UserName;

channelFactory.Credentials.UserName.Password = Password;

'Client.ClientDetails.ServiceContracts.IUserLoginLogoutService service = channelFactory.CreateChannel();

'Client.ClientDetails.ServiceContracts.UserLoginLogout.LoginUserResponse response = service.LoginUser(new 'Client.ClientDetails.ServiceContracts.UserLoginLogout.LoginUserRequest());

personId = response.PersonId;



App.config


<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

</configSections>

<system.serviceModel>

<bindings>

<wsHttpBinding>

<binding name="wsHttpUserNameCredential" closeTimeout="00:01:00"

openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"

bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"

maxBufferPoolSize="524288" maxReceivedMessageSize="5000000" messageEncoding="Text"

textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">

<readerQuotas maxDepth="200" maxStringContentLength="1000000" maxArrayLength="50000"

maxBytesPerRead="4096" maxNameTableCharCount="16384" />

<reliableSession ordered="true" inactivityTimeout="00:10:00"

enabled="false" />

<security mode="Message">

<transport clientCredentialType="Windows" proxyCredentialType="None"

realm="" />

<message clientCredentialType="UserName" negotiateServiceCredential="false"

algorithmSuite="Default" establishSecurityContext="true" />

</security>

</binding>

</wsHttpBinding>

</bindings>

<client>

<endpoint address=http://ClientIPAddress/webService/UserLoginLogoutService.svc

binding="wsHttpBinding" bindingConfiguration="wsHttpUserNameCredential"

contract="Client.ClientDetails.ServiceContracts.IUserLoginLogoutService"

name="WSHttpBinding_IUserLoginLogoutService">

<identity>

<certificate encodedValue="AwAAAAEAAAAUAAAADGGMlzc8Xgq8SHnv7WhbjjJUoewgAAAAAQAAAL0BAAAwggG5MIIBZ6ADAgECAhBL39wu0UkIpEu4bZIMG5gKMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMDcwMjIxMTYwOTE2WhcNMzkxMjMxMjM1OTU5WjAcMRowGAYDVQQDExFXZWJQRE1UZXN0U2VydmVyMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA78gD1vCbjoftBpFhgySkUrlN1v9bHAckEdrgs7z3XOfXQdGye27qa4A0FxQdEcmkvU/FN+m/xJIoiTveaE9xeh3QVcuS1BtZSlDDcVwYfFpODZfSb9GO0rjQ/bOtoAuyNZStpJag2sq4spvNdXSOw1zQwkYjXoFpzpbyiG24n5sCAwEAAaNLMEkwRwYDVR0BBEAwPoAQEuQJLQYdHU8AjWEh3BZkY6EYMBYxFDASBgNVBAMTC1Jvb3QgQWdlbmN5ghAGN2wAqgBkihHPuNSqXDX0MAkGBSsOAwIdBQADQQBGpUxSV2OD40jvBzIODy/GfHNYbsPLZFaeu2VeGRUN5fSnZJh/FRta7f/V8IfuzTtlH0kj6cux/+CIImioB2+U" />

</identity>

</endpoint>

</client>

</system.serviceModel>

</configuration>



From the application part if i remove application.exe.config i get the same error, which doesnt even hit the webservice because of not finding the config file

but i have place all referred dlls and the classlibrary and the classlibrary.dll.cofig in the same path

Can some one suggest me where am i going wrong



Thanks
Srinivas

解决方案

Hi Sri,

can you post the solution?

Damir


这篇关于使用+ Web服务(SVC)+ C#DLL找不到端点元素名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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