Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.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# 启动项目时,WCF中出现内部服务器错误_C#_Asp.net Mvc 3_Wcf_Rest_Web Config - Fatal编程技术网

C# 启动项目时,WCF中出现内部服务器错误

C# 启动项目时,WCF中出现内部服务器错误,c#,asp.net-mvc-3,wcf,rest,web-config,C#,Asp.net Mvc 3,Wcf,Rest,Web Config,当我启动asp.NETMVC项目时,我得到一个错误。内部服务器错误。 我在IIS express上托管asp.net mvc和wcf应用程序 <services> <service name="WCFSkyAuction.Service.UserRoleService"> <endpoint address="" behaviorConfiguration="WCFSkyAuction.Service.UserRoleServiceAs

当我启动asp.NETMVC项目时,我得到一个错误。内部服务器错误。 我在IIS express上托管asp.net mvc和wcf应用程序

 <services>
      <service name="WCFSkyAuction.Service.UserRoleService">
        <endpoint address="" behaviorConfiguration="WCFSkyAuction.Service.UserRoleServiceAspNetAjaxBehavior"
          binding="webHttpBinding" name="UserService" contract="WCFSkyAuction.Service.UserRoleService" />
      </service>
      <service name="WCFSkyAuction.Service.AdminRoleService">
        <endpoint address="" behaviorConfiguration="WCFSkyAuction.Service.AdminRoleServiceAspNetAjaxBehavior"
          binding="webHttpBinding" name="AdminService" contract="WCFSkyAuction.Service.AdminRoleService" />
      </service>
      <service name="WCFSkyAuction.Service.VipRoleService">
        <endpoint address="" behaviorConfiguration="WCFSkyAuction.Service.VipRoleServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="WCFSkyAuction.Service.VipRoleService"/>
      </service>
      <service name="WCFSkyAuction.Service.MailService">
        <endpoint address="" behaviorConfiguration="WCFSkyAuction.Service.MailServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="WCFSkyAuction.Service.MailService" />
      </service>
    </services>



 <endpointBehaviors>
        <behavior name="WCFSkyAuction.Service.UserRoleServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
        <behavior name="WCFSkyAuction.Service.AdminRoleServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
        <behavior name="WCFSkyAuction.Service.VipRoleServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
        <behavior name="WCFSkyAuction.Service.MailServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>

这是我在WCF端的配置文件,我在4个svc文件上都有带有webHttp绑定和契约的每个端点。所有方法都在带有operationcontract的svc文件中有正确的设置,只有一个参数。我已经确认服务很酷

<system.serviceModel>
    <client>
      <endpoint address="http://localhost:8080/WCFSkyAuction/Service/UserRoleService.svc"
        binding="webHttpBinding" bindingConfiguration="" behaviorConfiguration="webhttp" contract="UserService.UserRoleService"
        name="UserService" />
      <endpoint address="http://localhost:8080/WCFSkyAuction/Service/AdminRoleService.svc" 
                binding="webHttpBinding" behaviorConfiguration="webhttp" contract="AdminService.AdminRoleService"
        name="AdminService" />
    </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="webhttp">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

这是asp.net mvc端的web.config。我已经通过编辑WCF文件编写了客户端端点和行为。添加服务引用工作正常,我添加了所有引用。当我使用第一个服务操作启动项目时,我遇到了内部服务器错误。通信异常由用户代码处理。 谢谢。我怎么决定呢?

这表示您的c代码引发了异常。尝试将代码放入Try catch并记录异常。

这表示您的c代码引发了异常。尝试将代码放入Try catch并记录异常。

您必须在服务器配置中为行为写入
标记您必须在服务器配置中为行为写入
标记谢谢发布)当我跟踪时,我发现我无法在服务中指向方法(感谢发布)当我跟踪时,我看到我无法指向服务中的方法