小编BCd*_*WEB的帖子

WCF在运行时更改端点地址

我的第一个WCF示例正在运行.我有一个网站上的主机有很多绑定.因此,我已将此添加到我的web.config中.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
Run Code Online (Sandbox Code Playgroud)

这是我的默认绑定http://id.web,它使用以下代码.

EchoServiceClient client = new EchoServiceClient();
litResponse.Text = client.SendEcho("Hello World");
client.Close();
Run Code Online (Sandbox Code Playgroud)

我现在正在尝试在运行时设置端点地址.即使它与上述代码的地址相同.

EchoServiceClient client = new EchoServiceClient();
client.Endpoint.Address = new EndpointAddress("http://id.web/Services/EchoService.svc"); 

litResponse.Text = client.SendEcho("Hello World");
client.Close();
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

The request for security token could not be satisfied because authentication failed. 
Run Code Online (Sandbox Code Playgroud)

请建议我如何在运行时更改端点地址?

另外这里是我的客户配置,由Ladislav Mrnka提出要求

 <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IEchoService" 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="None" /> …
Run Code Online (Sandbox Code Playgroud)

c# wcf wcf-binding wcf-client

38
推荐指数
4
解决办法
12万
查看次数

由于对 .net 程序集的引用而无法创建程序集

我正在尝试从特定的 dll 创建程序集。我执行的命令是

CREATE ASSEMBLY "xx.xx.blobviewer" from 'D:\xx\xx\xx\BlobSniffer\BlobSniffer.dll' WITH PERMISSION_SET = unsafe

我得到的响应消息是:

程序集“BlobSniffer”引用程序集“system.runtime.serialization, version=4.0.0.0,culture=neutral, publickeytoken=b77a5c561934e089.”,当前数据库中不存在该程序集。SQL Server 尝试从引用程序集来自的同一位置定位并自动加载引用程序集,但该操作失败(原因:2(系统找不到指定的文件。))。请将引用的程序集加载到当前数据库中,然后重试您的请求。

我试图将请求的 .net dll-s 复制到 BlobSniffer 文件夹,但在复制所有引用的程序集后,我得到了这个:

为程序集“BlobSniffer”创建程序集失败,因为程序集“microsoft.visualbasic.activities.compiler”格式错误或不是纯 .NET 程序集。无法验证的 PE 标头/本机存根。

第一个问题,为什么我什至需要复制 .net 程序集,它们不应该被自动检索吗?

第二个问题,程序集被标记为格式错误有什么问题?该程序集也是 .net 框架的一部分,并且没有外部类。

.net c# sql-server clr

2
推荐指数
1
解决办法
4145
查看次数

标签 统计

c# ×2

.net ×1

clr ×1

sql-server ×1

wcf ×1

wcf-binding ×1

wcf-client ×1