无法添加服务。可能无法访问服务元数据

时间:2013-12-16 12:13:26

标签: c#

运行DataManagement.svc

时出现以下错误
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

Error: Cannot obtain Metadata from http://localhost/AppBuilder.WebService/DataManagement.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: http://localhost/AppBuilder.WebService/DataManagement.svc    Metadata contains a reference that cannot be resolved: 'http://localhost/AppBuilder.WebService/DataManagement.svc'.    The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<html>    <head>        <title>Configuration Error</title>        <style>         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}          p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }         pre {font-family:"Lucida Console";font-size: .9em}         .marker {font-weight: bold; color: black;text-decoration: none;}         .version {color: gray;}         .error {margin-bottom: 10px;}         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }        </style>    </head>    <body bgcolor="white">            <span><H1>Server Error in '/AppBuilder.WebService' Application.<hr width=100% size=1 color=silver></H1>            <h2> <i>Conf'.    The remote server returned an error: (500) Internal Server Error.HTTP GET Error    URI: http://localhost/ClaySys.AppBuilder.WebService/DataManagement.svc    There was an error downloading 'http://localhost/AppBuilder.WebService/DataManagement.svc'.    The request failed with the error message:--<html>    <head>        <title>Configuration Error</title>        <style>         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}          p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }         pre {font-family:"Lucida Console";font-size: .9em}         .marker {font-weight: bold; color: black;text-decoration: none;}         .version {color: gray;}         .error {margin-bottom: 10px;}         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }        </style>    </head>    <body bgcolor="white">            <span><H1>Server Error in '/AppBuilder.WebService' Application.<hr width=100% size=1 color=silver></H1>            <h2> <i>Configuration Error</i> </h2></span>            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">            <b> Description: </b>An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.            <br><br>            <b> Parser Error Message: </b>Could not load file or assembly 'Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.<br><br>            <b>Source Error:</b> <br><br>            <table width=100% bgcolor="#ffffcc">               <tr>                  <td>                      <code><pre>Line 173:    <healthMonitoring>Line 174:      <providers><font color=red>Line 175:        <add name="OracleWebEventProvider" type="Oracle.Web.Management.OracleWebEventProvider, Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString" buffer="true" bufferMode="OracleNotification" /></font>Line 176:      </providers>Line 177:    </healthMonitoring></pre></code>                  </td>               </tr>            </table>            <br>            <b> Source File: </b> C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config<b> ÿÿ Line: </b> 175            <br><br>            <b>Assembly Load Trace:</b> The following information can be helpful to determine why the assembly 'Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' could not be loaded.<br><br>            <table width=100% bgcolor="#ffffcc">               <tr>                  <td>                      <code><pre>WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].</pre></code>                  </td>               </tr>            </table>            <br>            <hr width=100% size=1 color=silver>            <b>Version Information:</b>ÿMicrosoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927            </font>    </body></html><!-- [FileNotFoundException]: Could not load file or assembly 'Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.   at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)   at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)   at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)   at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)   at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)[ConfigurationErrorsException]: Could not load file or assembly 'Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified. (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config line 175)   at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)   at System.Web.Configuration.HealthMonitoringSectionHelper.BasicSanityCheck()   at System.Web.Configuration.HealthMonitoringSectionHelper..ctor()   at System.Web.Configuration.HealthMonitoringSectionHelper.GetHelper()   at System.Web.Management.HealthMonitoringManager..ctor()   at System.Web.Management.HealthMonitoringManager.Manager()   at System.Web.Management.HealthMonitoringManager.get_Enabled()   at System.Web.Management.WebBaseEvent.RaiseSystemEventInternal(String message, Object source, Int32 eventCode, Int32 eventDetailCode, Exception exception, String nameToAuthenticate)   at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)[HttpException]: Could not load file or assembly 'Oracle.Web, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified. (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config line 175)   at System.Web.HttpRuntime.FirstRequestInit(HttpContext context)   at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)-->--.

我的配置包含

 <service behaviorConfiguration="test" name="AppBuilder.WebService.DataManagement">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="AppBuilder.WebService.IDataManagement" />
  </service>

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

我猜你没有启用元数据交换,请尝试添加:

<endpoint
     address="mex"
     binding="mexHttpBinding"
     contract="IMetadataExchange" />

实际上它在MSDN中有描述,也有样本。

您的配置可能如下所示:

<service behaviorConfiguration="test" name="AppBuilder.WebService.DataManagement">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="AppBuilder.WebService.IDataManagement" />

    <endpoint
     address="mex"
     binding="mexHttpBinding"
     contract="IMetadataExchange" />
</service>

或使用行为:

<behavior name="test">
    <serviceMetadata 
        httpGetEnabled="true" policyVersion="Policy15"/>
</behavior>