无法在实时网址

时间:2015-07-03 15:41:33

标签: c# web-services wcf

我创建了一个附加到eveleep sql数据库的wcf服务,该数据库返回一个everleap.com数据库。我在本地对我的代码进行了调查,以确保我可以恢复测试数据并且我做了但是当我尝试使用它的时候实时网址

  

http://1937-6187.el-alt.com/curoService.svc

它给我以下错误

  

![块引用]   enter image description here

我是否需要在webconfig中更改一些内容以允许它与远程URL一起工作,它会使indead重新查找方法并使用可以自己测试但是它不会返回json只是

我已经包含了我的网络配置以防万一我需要设置其他内容我已经隐藏了我的密码,原因很明显。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.6" />
    <httpRuntime targetFramework="4.6" />
  </system.web>
  <system.serviceModel>

    <services>
      <service name="Curo.curoService">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:4568/                           Design_Time_Addresses/Curo/curoService/" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="wsHttpBinding" contract="Curo.IcuroService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true" />
  </system.webServer>
  <connectionStrings>
 <add name="curoEntities" connectionString="metadata=res://*/CuroDB.csdl|res://*/CuroDB.ssdl|res://*/CuroDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=s03.everleap.com;initial catalog=DB_1937_curo;persist security info=True;user id=********_user;password=*******;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v12.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

EDIT1 当我将locahost值更改为以下web.config时,我收到以下错误。

  

错误:无法从http://1937-6187.el-alt.com/curoService.svc获取元数据如果这是您有权访问的Windows(R)Communication Foundation服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange错误URI上的MSDN文档:http://1937-6187.el-alt.com/curoService.svc元数据包含无法解析的引用:“http://1937-6187.el-alt.com/curoService.svc”。内容类型text / html;响应消息的charset = utf-8与绑定的内容类型不匹配(application / soap + xml; charset = utf-8)。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。响应的前1024个字节是:'IIS 8.5详细错误 - 500.19 - 内部服务器错误http://1937-6187.el-alt.com/curoService.svc下载“http://1937-6187.el-alt.com/curoService.svc”时出错。请求失败并显示错误消息: - IIS 8.5详细错误 - 500.19 - 内部服务器错误

HTTP错误500.19 - 内部服务器错误

无法访问请求的页面,因为相关的配置数据为页面无效。详细错误信息:ModuleÿÿÿIISWeb核心通知ÿÿÿ未知处理程序ÿÿÿ尚未确定错误代码ÿÿÿ0x8007000d配置错误ÿÿÿ配置文件格式不正确XML配置文件ÿÿÿ\?\ C:\ inetpub \ temp \ DWASFiles \ Sites \ 1937-6187 \ VirtualDirectory0 \ site \ wwwroot \ web。 config请求的URLÿÿÿhttp://1937-6187.el-alt.com:80/curoService.svc物理路径ÿÿÿ登录方法ÿÿÿ尚未确定登录用户ÿÿÿ尚未确定配置来源:
    1: ?        2:     
更多信息:出现问题时会发生此错误读取Web服务器或Web应用程序的配置文件。在某些情况下,事件日志可能包含有关导致此错误的原因的更多信息。

View more information ¯

- 。

调整后的网络配置会产生上述错误。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
  </system.web>
  <system.serviceModel>

    <services>
      <service name="Curo.curoService">
        <host>
          <baseAddresses>
            <add baseAddress="http://1937-6187.el-alt.com/" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="wsHttpBinding" contract="Curo.IcuroService">
          <identity>
            <dns value="http://1937-6187.el-alt.com/" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true" />
  </system.webServer>
  <connectionStrings>
  <add name="curoEntities" connectionString="metadata=res://*/CuroDB.csdl|res://*/CuroDB.ssdl|res://*/CuroDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=s03.everleap.com;initial catalog=DB_1937_curo;persist security info=True;user id=DB_1937_curo_user;password=Lisa2015d;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v12.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

奇怪的是它返回方法很好,但是当我点击调用时,它会返回从本地主机更改为实时主机的第二个错误。

完整堆栈跟踪表明存在某种身份验证错误,但在web.config中没有用例和用户名密码正确

  

该服务未对呼叫者进行身份验证。

Server stack trace: 
   at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
   at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout)
   at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
   at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IcuroService.GetPersonById(Int32 PersonId)
   at IcuroServiceClient.GetPersonById(Int32 PersonId)

Inner Exception:
The request for security token could not be satisfied because authentication failed.
   at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target)
   at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)

1 个答案:

答案 0 :(得分:0)

对于遇到同样问题的其他人,我只需更改此行

  

endpoint address =“”binding =“basicHttpsBinding”   合同= “Curo.IcuroService”

使用basicHttpsBinding我不知道如果挂钩形成手机应用程序的安全含义