Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.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
C# 找不到名为'';和合同'';在ServiceModel客户端配置部分中_C#_Asp.net_Web Services_Wcf_Sharepoint - Fatal编程技术网

C# 找不到名为'';和合同'';在ServiceModel客户端配置部分中

C# 找不到名为'';和合同'';在ServiceModel客户端配置部分中,c#,asp.net,web-services,wcf,sharepoint,C#,Asp.net,Web Services,Wcf,Sharepoint,我已经试了好几天来解决这个该死的错误。我在asp.net中调用相同的服务,它工作正常,但在sharepoint解决方案中调用它时,它不工作。这是我收到的错误 Could not find endpoint element with name 'WeatherSoap' and contract 'WeatherService.WeatherSoap' in the ServiceModel client configuration section. This might be because n

我已经试了好几天来解决这个该死的错误。我在asp.net中调用相同的服务,它工作正常,但在sharepoint解决方案中调用它时,它不工作。这是我收到的错误

Could not find endpoint element with name 'WeatherSoap' and contract 'WeatherService.WeatherSoap' 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 app.config:

<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="WeatherSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
        <customBinding>
            <binding name="WeatherSoap12">
                <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                    messageVersion="Soap12" writeEncoding="utf-8">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                </textMessageEncoding>
                <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
                    maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
                    bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
                    keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
                    realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                    useDefaultWebProxy="true" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint address="http://wsf.cdyne.com/WeatherWS/Weather.asmx"
            binding="basicHttpBinding" bindingConfiguration="WeatherSoap"
            contract="WeatherService.WeatherSoap" name="WeatherSoap" />
        <endpoint address="http://wsf.cdyne.com/WeatherWS/Weather.asmx"
            binding="customBinding" bindingConfiguration="WeatherSoap12"
            contract="WeatherService.WeatherSoap" name="WeatherSoap12" />
    </client>
</system.serviceModel>
这是我在sharepoint visual web部件和asp.net网页的代码隐藏中使用的代码。奇怪的是,它在asp.net中运行良好,但在sharepoint中却不行。 我正在同一个项目中调用该服务。

查看此链接:


您可能需要以编程方式为sharepoint web部件添加和配置wcf终结点。

sharepoint可视web部件是asp.net网站的一部分吗?从错误中可以看出,应用程序的配置文件(不是调用服务的库)似乎没有所需的信息。
WeatherService.WeatherSoapClient client = new WeatherService.WeatherSoapClient("WeatherSoap");
 WeatherService.WeatherReturn result = client.GetCityWeatherByZIP(txtZip.Text);